This tutorial covers how to compile oci8 lib with php5 on Ubuntu Server.
For this edition it is assumed that you are issuing these commands from the command line.
Open a Terminal “CTRL+ALT+T” and issue a sudo -i
sudo -i
Install Apache2
apt-get install apache2
Install required PHP5 modules and libraries
apt-get install php5-common php5 php5-dev libapache2-mod-php5 php5-cli
Install the build-essential and php-pear packages
apt-get install build-essential php-pear
IMPORTANT! Install libaio1 library. This is what I was having serious issues with originally.
apt-get install libaio1
Download the new Instantclient and SDK zip files from Oracle.
link
In my case the files are called Basic.zip and Sdk.zip Initially these files will be saved in my home directory under the Documents folder /home/ubuntu/Documents/
create a directory to house the zip files once they are uncompressed
mkdir /opt/oracle
move the .zip files in the “Documents” directory to the /opt/oracle directory
mv /home/ubuntu/Documents/*.zip /opt/oracle
Change to the /opt/oracle directory
cd /opt/oracle
Unzip the files
unzip \*.zip
rename instantclient directory
mv instantclient_11_1 instantclient
Change directory to instantclient, list the files
cd instantclient
Create symbolic links
ln –s libclntsh.so.11.1 libclntsh.so
ln –s libocci.so.11.1 libocci.so
Create a source directory under /opt/oracle . This is where we will house the oci8 libraries.
mkdir /opt/oracle/src
Change the directory to /opt/oracle/src and download the oci8 tar using pecl
cd /opt/oracle/src
pecl download oci8
Untar the oci8 libraries
tar xvf oci8-1.2.4.tgz
Change to the newly created oci8-1.2.4 directory and issue the following commands
cd oci8-1.2.4
phpize
Set the ORACLE_HOME environment variable
export ORACLE_HOME=/opt/oracle/instantclient
echo $ORACLE_HOME
cd /opt/oracle/instantclient
Configure oci8 to install with the necessary parameters
./configure --with-oci8=share,instantclient,/opt/oracle/instantclient
run make to compile
make
install oci8
make install
insert the extension=oci8.so into the php.ini and cli.ini files
echo extension=oci8.so >> /etc/php5/apache2/php.ini
echo extension=oci8.so >> /etc/php5/cli/php.ini
restart apache
/etc/init.d/apache2 restart or service apache2 restart
create a phpinfo.php file in /var/www
vi /var/www/phpinfo.php
Now go to your browser and run the phpinfo file and look for the oci8 module
Download my oratest php template file and configure it with the needed settings.
Test the connection
php /home/ubuntu/oratest.php
Connection Succesful
IMPORTANT
add follwing lines to /etc/apache2/envvars
export LD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 export ORACLE_HOME=/opt/oracle/instantclient_11_2 export TNS_ADMIN=/opt/oracle/tns/
Reblogged this on SutoCom Solutions.
This Link , isnt here , can you tell me where to download the correct files
For the new Instantclient and SDK zip files from Oracle.
Thanks for the marvelous posting! I really enjoyed reading it,
you can be a great author.I will be sure to bookmark your blog and will eventually come back
later in life. I want to encourage continue your great posts, have a nice evening!