Analytic

Wednesday, August 22, 2012

Installing OCI8 On Debian

OCI8 is an extension for providing APIs to Oracle database management system. You need Apache, PHP and Oracle Instant Client.

Register and Download Oracle Instant Client. Choose your platform compatibility (in my case x64), if the package not compatible with your platform then installation process will failed. At least, we just need Basic and SDK. Then put on /opt/oracle or whatever directory did you liked:

mkdir /oracle_client
mkdir /opt/oracle
cd /opt/oracle


 unzip instantclient-basic-linux.x64-11.2.0.3.0.zip
 unzip instantclient-sdk-linux.x64-11.2.0.3.0.zip
 mv /opt/instantclient_11_2/* /oracle_client/

 Create symbolic links for dinamic library and Add instant client to system ld:

cd /oracle_client
ln -s libclntsh.so.11.1 libclntsh.so
ln -s libocci.so.11.1 libocci.so

Compiling OCI8 and enter instantclient,/oracle_client when you are prompted:

pecl install oci8

Enable oci8 extension on php.ini or add it to php Conf:

vim /etc/php5/conf.d/oci8.ini 

and add this line to file:

extension=oci8.so

then restart apache2 web server.

/etc/init.d/apache2 restart

Then check phpinfo() and the successfull installation should be :



When you get this error:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/oci8.so' - libaio.so.1: cannot open shared object file: No such file or directory in Unknown on line 0

you should install libaio:

apt-get install libaio1

2 comments:

Евгений Слежук said...

Thanks for libaio tip. Saved my day! :)

Mike said...

Perfeito. Precisava usar uma versão antiga e esse me salvou a pele.
VLW