Install Oracle client on Ubuntu
- Scroll to Downloads and click on: Instant Client for Linux x86-64
- Accept the license agreement and find the x64.rpm files containing the following string:
- basic
- sqlplus
- devel
- Install the rpm to deb conversion tool:
apt-get install alien
- install the 3 packages in the following order:
alien -i oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
alien -i oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
- The above file names will vary according to the version. The alien tool will generate and save the respective .deb file and install the package
- Install the required library:
apt-get install libaio1
- Add the oracle client library to linker path:
- Find the path for the Oracle libraries. It should be in /usr/lib/oracle/12.1/client
You are looking for a lib folder inside.
- create (or edit) the file /etc/ld.so.conf.d/oracle.conf
- Add the folder you found to the above file
- refresh the library paths:
ldconfig
- run the client and attempt to connect to the database:
sqlplus username/password@//dbhost:1521/SID
- Install the required package - OCI8 for PHP:
apt-get install pear php7.0-dev
- Attempt to install the PHP extension:
pecl install oci8
The install script will autodetect the oracle client path
- Add the extension=oci8.so line to your /etc/php/7.0/fpm/php.ini file
- Restart the FPM service:
service php7.0-fpm restart