Installing OCI8 on Ubuntu
If we want to use a database from PHP, we need to install OCI8 extension, which it will provide an API to the use of Oracle databases.
Installing OCI8 on Ubuntu is not as easy as doing an apt-get, as it takes some SDK packages provided by Oracle and their distribution license prevents that can be included in Linux distributions. This means we will have to download and compile them ourselves.
Below is the steps to follow:
1. Install PEAR and PECL.
2. Download ''Oracle Instant Client''. We need at least the following packages 'Basic' and 'SDK'.
3. Unzip the files
The 'X' should be replaced by the appropriate version.
4. Create symbolic links.
5. Add 'instant client' to the system.
6. Compiling oci8
WARNING: If you are behind a proxy, you have to run:
7. Enter 'instantclient, / opt / oracle / instantclient' when prompted on the command line.
8.Enable the extension.
9. Restart apache2.
We should now have available OCI8 extension to use from our PHP applications.
Below is the steps to follow:
1. Install PEAR and PECL.
sudo apt-get install php-pear
2. Download ''Oracle Instant Client''. We need at least the following packages 'Basic' and 'SDK'.
3. Unzip the files
sudo mkdir -p /opt/oracle cd /opt/oracle sudo unzip instantclient-basic-linux-xxxxxxx.zip sudo unzip instantclient-sdk-linux-xxxxxxx.zip sudo mv /opt/oracle/instantclient_xx_x /opt/oracle/instantclient
The 'X' should be replaced by the appropriate version.
4. Create symbolic links.
cd /opt/oracle/instantclient sudo ln -s libclntsh.so.xx.x libclntsh.so sudo ln -s libocci.so.xx.x libocci.so
5. Add 'instant client' to the system.
sudo su -
echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient exit
6. Compiling oci8
sudo pecl install oci8-2.0.10
WARNING: If you are behind a proxy, you have to run:
pear config-set http_proxy http://myproxy.com:PORT/
7. Enter 'instantclient, / opt / oracle / instantclient' when prompted on the command line.
8.Enable the extension.
sudo su - echo extension=oci8.so >> /etc/php5/apache2/php.ini
9. Restart apache2.
sudo /etc/init.d/apache2 restart
We should now have available OCI8 extension to use from our PHP applications.