Dec 04 2009

Using ORACLE and PHP in Ubuntu

Category: PHPBipin Balakrishnan @ 10:59 am

oracle-php

Last week i got a chance to try ORACLE API, as i was a fresher in oracle at that time i was having little idea how to use it.After googling a while i got the way to use it.The steps i followed are written below in future hope this will find helpful for someone .
For setting up in local machine we need to install oracle Oracle Express Edition first. Please note my machine was , Ubuntu 9.04 and this worked for me.
Installing Oracle Express Edition
First you need to add this line to your /etc/apt/sources.lst

deb http://oss.oracle.com/debian unstable main non-free

Run

sudo wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | apt-key add -
sudo apt-get update
sudo apt-get install oracle-xe

Then run

sudo /etc/init.d/oracle-xe configure

PHP-Oracle Binding
Now install PHP-oracle binding, will get it from here

Convert the rpm packages into debian packge using alien program if its not installed in your machine please install it using

sudo apt-get install alien

Run the commend in the downloaded packege folder

sudo alien oracle*.rpm

You’ll need the ‘pecl’ command, which is available in php-pear, php5-dev

sudo apt-get install php-pear php5-dev
sudo pecl install oci8

Enter 1 and check the oracle client lib path will be like this.

instantclient,/usr/lib/oracle/11.2/client/lib

Hit enter again and wait for a while.After completion add “extension=oci8.so” in your php.ini( both apache and cli) .Restart apache2 and check phpinfo();Okey our machine is ready to make calls to oracle binding functions and remote APIs.

The rest you can try out from here

Tags: , , ,