Linux install oracle instant client + PHP PDO_OCI library

Download appropriate oracle instant client
(base and sdk packages important!)

 Extract those files in a directory


Set oracle home variable

export ORACLE_HOME=/opt/instantclient_11_2/

Create symlinks for libraries

ln -s /opt/instantclient_11_2/ /opt/instantclient_11_2/
ln -s /opt/instantclient_11_2/ /opt/instantclient_11_2/
ln -s /opt/instantclient_11_2/ /opt/instantclient_11_2/lib

Install PDO_OCI
If you already have php installed, you can compile only the PDO_OCI from PHP source. (Do not install with pecl because it’s deprecated)

  • Download the PHP source with same version that you have installed
  • Extract
  • Change to directory php-YOUR-VERSION/ext/pdo_oci

Run commands to compile PDO_OCI

./configure --with-pdo-oci=instantclient,/opt/instantclient_11_2,11.2
make && make install
echo "" > /etc/php.d/pdo_oci.ini

Restart web server
service httpd restart