Installing Oracle OCI (oci8) library to Lubuntu 10.04.4 LTS – Using OCI instantclient 12.1

First Check Version of your Ubuntu

Run Command :  lsb_release -a

Distributor ID: Ubuntu
Description: Ubuntu 10.04.4 LTS
Release: 10.04
Codename: lucid

Pre Requisites:

sudo apt-get install build-essential
sudo apt-get install php5-dev php-pear libaio1

Instant Client installation requires some environment variables to be able to see the library folder. Edit /etc/environment and add at the end:

# Oracle Instant Client LD_LIBRARY_PATH=”/usr/local/lib/instantclient_12_1″ TNS_ADMIN=”/usr/local/lib/instantclient_12_1″ ORACLE_BASE=”/usr/local/lib/instantclient_12_1″ ORACLE_HOME=$ORACLE_BASE

Now Download Right Version of Oracle Install Client
32 Bit :

64 Bit

Now transfer the downloaded file from local pc to ubuntu server using WinSCP

winscp

  • cd /usr/local/lib
  • sudo unzip <location-of-instant-client-basic>
  • sudo unzip <location-of-instant-client-sdk>
  • cd instantclient_12_1
  • sudo ln -s libclntsh.so.12.1 libclntsh.so

The symbolic link is needed during the compilation step later.

  • sudo pecl install oci8

You will be prompted for the location of the library:

instantclient,/usr/local/lib/instantclient_12_1

PHP5 Instructions

You should now create a new oci8.ini file which will be included when loading php.ini (Editing the php.ini is discouraged):

nano /etc/php5/conf.d/oci8.ini

this will create a blank file; add to this file:

extension=oci8.so

In Ubuntu 13.10, you should create a new oci8.ini in:

nano /etc/php5/apache2/conf.d/oci8.ini

this will create a blank file. Then add to this file:

extension=oci8.so

Restart Apache

  • sudo service apache2 restart

Check <?php echo phpinfo() ?> to verify if the oci8 module is available.

PHP Version 5.4.39-1+deb.sury.org~lucid+2

 

System Linux moodlet 2.6.32-38-server #83-Ubuntu SMP Wed Jan 4 11:26:59 UTC 2012 x86_64
Build Date Mar 24 2015 10:55:35
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php5/apache2
Loaded Configuration File /etc/php5/apache2/php.ini
Scan this dir for additional .ini files /etc/php5/apache2/conf.d
Additional .ini files parsed /etc/php5/apache2/conf.d/10-pdo.ini, /etc/php5/apache2/conf.d/20-mysql.ini, /etc/php5/apache2/conf.d/20-mysqli.ini, /etc/php5/apache2/conf.d/20-pdo_mysql.ini, /etc/php5/apache2/conf.d/20-readline.ini, /etc/php5/apache2/conf.d/oci8.ini
PHP API 20100412
PHP Extension 20100525
Zend Extension 220100525
Zend Extension Build API220100525,NTS
PHP Extension Build API20100525,NTS
Debug Build no
Thread Safety disabled
Zend Signal Handling disabled
Zend Memory Manager enabled
Zend Multibyte Support provided by mbstring
IPv6 Support enabled
DTrace Support disabled
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

oci8.