You are on page 1of 2

Installing the Oracle Instant Client Files

1. Download the Oracle Instant Client for Linux (Both the Basic and SDK versions) from here.
Make sure you choose the correct architecture for your Ubuntu installation (32bit is x86, 64bit
is x86_64).
2. Copy the files just downloaded to your Ubuntu server using scp or the WinSCP application for
windows.
3. ssh into your ubuntu server using your favorite ssh client
4. Install PECL, PHP Development files, Build Essential, Unzip, and the AIO Library
apt-get install php-pear php5-dev build-essential unzip libaio1

5. Create the oracle directory


mkdir /opt/oracle

6. Move the downloaded files


mv instantclient-* /opt/oracle

7. Unzip the files using the unzip command (unzip <filename>)


8. Rename the created directory
mv instantclient_11_2 instantclient

9. cd into the instant client directory and create the following soft links
ln -s libclntsh.so.11.1 libclntsh.so
ln -s libocci.so.11.1 libocci.so

10. cd to /opt
11. set the permissions on the directory
chown -R root:www-data /opt/oracle

12. Add the instant client to the the ld config files


echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient

13. Update the Dynamic Linker Run-Time Bindings


ldconfig

Installing OCI 8 and Configuring Apache


1. Install OCI8 using PECL
download oci8 http://pecl.php.net/package/oci8

./configure --with-oci8=instantclient,/opt/oracle/instantclient
make install

2. Add the extension to the php.ini files


echo extension=oci8.so >> /etc/php5/apache2/php.ini
echo extension=oci8.so >> /etc/php5/cli/php.ini

3. Restart Apache
/etc/init.d/apache2 restart

4. Verify the installation of the OCI8 library by creating a simple phpinfo page.
touch info.php; echo "<?php phpinfo(); ?>" > info.php

5. Navigate to the page using your favorite web browser and confirm the OCI8 section is present.

*when apache2 not installed on php directory, use this command

sudo apt-get install libapache2-mod-php7.0

You might also like