Table of Contents
Install oracle client under Linux and configure php5.3, oraclephp5.3
How to install Oracle client under linux
Home Backend Development PHP Tutorial Install oracle client and configure php5.3 under Linux, oraclephp5.3_PHP tutorial

Install oracle client and configure php5.3 under Linux, oraclephp5.3_PHP tutorial

Jul 13, 2016 am 10:17 AM
linux oracle Install client Configuration

Install oracle client under Linux and configure php5.3, oraclephp5.3

Since the project requires the Oracle client compilation of php5.3 under Linux, I would like to briefly introduce the steps and detours taken.

1. Download the Oracle client package, which contains related files such as OCI, OCCI and JDBC-OCI.

1.1 Download file address

http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
Select the corresponding software according to the version of the operating system. What I need is X86_64 selection
Instant Client for Linux x86-64

The files that need to be downloaded for 1.2 are as follows:

Copy code The code is as follows:

oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm
oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm
oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.x86_64.rpm

One thing that needs to be emphasized is that you need to register an oracle account to download normally.

2. Install the Oracle client package.

Upload the program package to the specified directory on the server

Copy code The code is as follows:

chmod +x *.rpm
#Give execution permissions to the RPM package
rpm -ivh oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm oracle-instantclient11.1-sqlplus-11.1 .0.7.0-1.x86_64.rpm
#Install RPM package
echo "/usr/lib/oracle/11.1/client64/lib/" > /etc/ld.so.conf.d/oracle_client.conf
#Add the library path to the default load
/sbin/ldconfig
#Reload dynamic link library

3. Install the OCI8 php extension (the installation path of php specified here is /usr/local/webserver/php)

Copy code The code is as follows:

yum install libaio
#yum installs the libaio library. libaio is an asynchronous non-blocking interface under Linux. It provides a way to read and write files in an asynchronous non-blocking way, and the reading and writing efficiency is relatively high
wget http://pecl.php.net/get/oci8-1.4.10.tgz
#DownloadOCIExtension
tar zxvf oci8-1.4.10.tgz
#unzip
cd oci8-1.4.10
/usr/local/webserver/php/bin/phpize CFLAGS="-I/usr/lib/oracle/11.1/client64" CXXFLAGS="-I/usr/lib/oracle/11.1/client64"
#Use phpize to prepare the compilation environment of the PHP plug-in module. The makefile required for compilation will be generated according to the specified environment variables. phpize is the content of php-devel, so under centos, just run yum install php-devel to install it
./configure –with-php-config=/usr/local/webserver/php/bin/php-config –with-oci8=/usr/lib/oracle/11.1/client64
make
make install
#Compile, install

It should be emphasized that when making, an error will be reported, showing that various library files cannot be found. The makefile needs to be modified to add the runtime address of oralce
Open the makefile and look for INCLUDE in the following form:
INCLUDES = -I/usr/local/php/include/php -I/usr/include/oracle/10.2.0.3/client
Then add =="-I/usr/lib/oracle/11.1/client64 at the end, and then make again and it will succeed.

4. Modify PHP.ini (/usr/local/webserver/php/etc/php.ini)

Add a line after extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/":

Copy code The code is as follows:

extension = "oci8.so"

5. Restart apache to allow OCI to take effect

6. Create the phpinfo.php file in the web directory, enter the content in it, and access it through the web

Copy code The code is as follows:

phpinfo();
?>

If you find the OCI8 part, it means that the OCI installation is normal, as shown in the picture below

Next, you can access the Oracle database through PHP. What you need to pay attention to is the Oracle connection string under PHP

Copy code The code is as follows:

$username='***';
$passwd='***';
$protocol='TCP';
$SERVICE_NAME='***';
$ORACLE_SERVER_IP_ADDRESS='***.***.***.***';
$Port='1521′;
$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = $protocol)(HOST = $ORACLE_SERVER_IP_ADDRESS)(PORT = $Port)))(CONNECT_DATA=(SID=$SERVICE_NAME)))";
$conn = oci_connect($username,$passwd, $db);
PutEnv("NLS_LANG=SIMPLIFIED CHINESE_CHINA.AL32UTF8");
if (!$conn) {
$e = oci_error();
Print htmlentities($e['message']);
exit;
}else {
echo "Connection to oracle successful!";
Return $conn;
}
?>

How to install Oracle client under linux

Install rpm as root user -ivh oracle-instantclient-basic-11.1.0.1-1.x86_64.rpmrpm -ivh oracle-instantclient-sqlplus-11.1.0.1-1.x86_64.rpm configure vim /etc/profile add export ORACLE_HOME=/usr/lib/oracle/11.1.0.1/client64export ORACLE_BASE=/usr/lib/oracle/11.1.0.1export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATHexport NLS_LANG=AMERICAN_AMERICA.AL32UTF8 After setting the environment variables, you need to restart the machine! Create the configuration file. Create the following directory network/admin in the ORACLE_HOME directory, and create the file tnsnames.ora with the following content: vim /usr/lib/oracle/11.1.0.1/client64/network/admin/tnsnames.ora# tnsnames.ora Network Configuration File: /opt/oracle10g/u01/network/admin/tnsnames.ora# Generated by Oracle configuration tools.111 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.111)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = dmsdb) ) ) Test to the ORACLE_HOME/bin directory and execute the command: [yleesun@centos bin]$ ./sqlplus zxd/zxd@111Copyright (c) 1982, 2011, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL>Test successful! Note: If the following error occurs: sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory, the environment variable does not take effect!

How to install Oracle client under linux

Install as root user
rpm -ivh oracle-instantclient-basic-11.1.0.1-1.x86_64.rpm
rpm -ivh oracle-instantclient-sqlplus-11.1.0.1-1.x86_64.rpm configuration
vim /etc/profile add
export ORACLE_HOME=/usr/lib/oracle/11.1.0.1/client64
export ORACLE_BASE=/usr/lib/oracle/11.1.0.1
export LD_LIBRARY_PATH=$ ORACLE_HOME/lib:$LD_LIBRARY_PATH
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
After setting the environment variables, you need to restart the machine!
Create configuration file
Create the following directory network/admin in the ORACLE_HOME directory, and create the file tnsnames.ora with the following content:
vim /usr/lib/oracle/11.1.0.1/client64/network/admin /tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/oracle10g/u01/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.111 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.111)(PORT = 1521)))
(CONNECT_DATA =
(SERVICE_NAME = dmsdb))) TEST
to ORACLE_HOME /bin directory, execute the command:
[yleesun@centos bin]$ ./sqlplus zxd/zxd@111
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL test successful! Note:
If the following error occurs:
It means the environment variable does not take effect!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/892259.htmlTechArticleInstall the oracle client under Linux and configure php5.3, oraclephp5.3 because the project requires php5 under Linux. 3 oracle client compilation, briefly introduce the steps and detours taken. 1. Download O...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1249
24
Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

How to run sublime after writing the code How to run sublime after writing the code Apr 16, 2025 am 08:51 AM

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

laravel installation code laravel installation code Apr 18, 2025 pm 12:30 PM

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

git software installation git software installation Apr 17, 2025 am 11:57 AM

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)

MongoDB vs. Oracle: Choosing the Right Database for Your Needs MongoDB vs. Oracle: Choosing the Right Database for Your Needs Apr 22, 2025 am 12:10 AM

MongoDB is suitable for unstructured data and high scalability requirements, while Oracle is suitable for scenarios that require strict data consistency. 1.MongoDB flexibly stores data in different structures, suitable for social media and the Internet of Things. 2. Oracle structured data model ensures data integrity and is suitable for financial transactions. 3.MongoDB scales horizontally through shards, and Oracle scales vertically through RAC. 4.MongoDB has low maintenance costs, while Oracle has high maintenance costs but is fully supported.

See all articles