To connect to Oracle DBMS from any PHP application, we need to install OCI8 Pear extension.
STEP 1
Download
oracle-instantclientXX-basic-XX.x86_64.rpm
oracle-instantclientXX-devel-XX.x86_64.rpm
Please choose the correct OS architecture (if 32bit choose x86, if 64bit choose x86_64).
Note:XX is the version.
STEP 2
Make sure you have these following Prerequisites:
sudo apt-get install php5-dev php-pear libaio1
#converts rpm to deb
sudo apt-get install alien
STEP 3
#convert RPM to DEB
sudo alien oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
sudo alien oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
sudo alien oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
#Install DEB files
sudo dpkg -i oracle-instantclient12.1-basic_12.1.0.2.0-2_amd64.deb
sudo dpkg -i oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb
sudo dpkg -i oracle-instantclient12.1-sqlplus_12.1.0.2.0-2_amd64.deb
sudo pecl channel-update pear.php.net
sudo pecl install oci8
STEP 4
Next, To enable the ocsi8, create a symlink to Instant Client files.
sudo echo “extension=oci8.so” >> /etc/php5/cli/conf.d/oci8.ini
sudo echo “extension=oci8.so” >> /etc/php5/apache2/conf.d/oci8.ini
STEP 5
Restart Apache Server
sudo service apache2 restart