Get the App
SLTechnology News&Howtos  ›  Database  › 

Installation and configuration of php oracle extension OCI8 under linux system

Shulou Source: shulou.com Published: 2022-06-01 12:22:28 10月26日 Update

Installation and Configuration of PHP Oracle Extension OCI8 under Linux System

PHP program access oracle DB

Date: September 2, 2014

Author: qunyingliu

Environment Description: Apache version, PHP version,Oracle DB version, Linux distribution version

RPM package installation oracle-instantclient client

source code compilation install oci8 extension

System environment and php configuration modification: ld.so.conf.d directory configuration file and php.ini extension field information modification

Restart apache to take effect

Test the link code to confirm successful configuration

Environment Description:

Local System: Centos Linux 6.4 x64

apache 2.2.22:/usr/local/apache2

PHP 5.4 : /usr/local/php

oracle DB 11.2.0.4

RPM package installs local oracle client:

Download the following RPM packages from oracle Instant Client:

http://www.oracle.com/technetwork/cn/topics/linuxx86-64soft-092277.html

oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm

oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm

oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm

Use the following command to install:

rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm

rpm -ivh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm

rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm

Oci8 extension download:

wget http://pecl.php.net/get/oci8-1.4.10.tgz

Decompress: tar -zxvf oci8-1.4.10.tgz

Installation:

cd oci8-1.4.10/usr/local/php/bin/phpize CFLAGS="-I/usr/lib/oracle/11.2.0.4.0/client64/" CXXFLAGS="-I/usr/lib/oracle/11.2.0.4.0/client64/"

./ configure --with-php-config=/usr/local/php/bin/php-config --with-oci8=instantclient,/usr/lib/oracle/11.2.0.4.0/client64/lib/

make

make instal

The lphp path and oracle client path need to be modified according to the actual situation.

If the pecl program exists on your system, you can install the oci8 extension by issuing the following command:

pecl install oci8

System environment and php configuration modification Modify system configuration:

echo "/usr/lib/oracle/11.2.0.4.0/client64//lib/"

>/etc/ld.so.conf.d/oracle_client.conf/sbin/ldconfig

Modify the php.ini configuration file:

extension_dir = "/usr/local/php5/lib/ext"

extension = "oci8.so"

oci8.privileged_connect = on

Restart apache to take effect

/usr/local/apache2/bin/apachectl restart

Test the link code to confirm successful configuration

Related references:

http://php.net/manual/zh/function.oci-connect.php

http://php.net/manual/zh/book.oci8.php

http://pecl.php.net/get/oci8-1.4.10.tgz

http://pecl.php.net/package-changelog.php? package=oci8

http://www.oracle.com/technetwork/cn/topics/linuxx86-64soft-092277.html

Tags: Configuration system version environment actual success code information commands files source code programs paths links tests compilers writers fields clients clients Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Shulou Tech Info Linux Redmi Huawei