Adding Oracle support to PHP

If you want to connect to an Oracle database with PHP you will need the pecl module named oci8

First in order to compile it you will need Oracle Instant Client ( both basic & sdk ) . You can download them from here:

http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html

If you don’t have an Oracle account you will need to create one.

At the time of this post the following files are available: instantclient-basic-linux32-11.2.0.1.zip , instantclient-sdk-linux32-11.2.0.1.zip .

Create a directory in /optĀ  mkdir /opt/oracle/instantclient and copy those files there . Then unzip them . You will need to create a symbolic link ln -s libclntsh.so.11.1 libclntsh.so

Then you will need to install libaio if you don’t have it already . Don’t forget to add /opt/oracle/instantclient/instantclient_11_2 to /etc/ld.so.conf .

At this point you are ready to install the pecl extension to php.Create a temporary directory ( /tmp/1 ) and cd there.

mkdir /tmp/1

cd /tmp/1

pecl download oci8

tar xf oci8-1.3.5.tar

cd oci8-1.3.5

phpize

./configure –with-oci8=shared,instantclient,/opt/oracle/instantclient/instantclient_11_2

make

make install

edit /etc/php.ini and add

extension=oci8.so

And enjoy oracle extension for php. Note: if you have apache running restart it.