简体   繁体   中英

Oci_connect function is undefined in CentOS with Oracle

oracle database connectivity issue in php with oci_connect function is undefined on linux centOs 7 follows this article too. Centos 6 PHP OCI8 extention is not working (Undefined function oci_connect())

Not found perfect solution for this.

You need install [OCI8] extension in php.ini:

Install both RPM packages:

rpm -ivh instantclient-basic-linux.XXX.rpm
rpm -ivh instantclient-sdk-linux.XXX.rpm

Install some prerequisite:

yum install php-pear
yum install php-devel

Download the OCI8 extension:

pear download pecl/oci8
tar xvzf oci8-1.4.7.tgz
cd oci8-1.4.7/
phpize

Configure the extension with your Oracle client library path (change the path …/11.2/… with your own version):

./configure --with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client64/lib/

Compile and install:

make
make install

Now enable extension in php.ini

cd /etc/php.ini

And do to the following line:

[OCI8]

and enable extension:

;extension=oci8.so

to

extension=oci8.so

And restart server service:

service apache2 restart

or

service httpd restart

You have oci_connect () defined.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM