Mike Macgirvin
Diary and Other Rantings
Beyond Silicon Valley
   
Saturday, May 10 2008, 12:08 am
Feb 14, 2008
Installing Oracle (oci8) into pre-built Debian php5

Some notes to save somebody some grief:

Installing the Oracle libraries and access module into an existing PHP5 installation on Debian...

First grab the Linux instantclient from oracle.com - you'll also need the client SDK kit. Here I'm using instantclient 11.1

create a directory for these such as /home/oracle and unpack both of them to that directory.

Go into the oracle directory (and into the instantclient_11_1 directory) and create a symlink:

$ ln -s libclntsh.so.11.1 libclntsh.so

Grab the oci8 PECL package and unpack it somewhere (~/oci).

Make sure you have the following packages (in addition to php5, php5-cli, apache2, etc).

  php5-dev

  libaio1

Go to the oci8 directory (~/oci/oci8-1.3.0). Forget about 'pecl build' - which won't work. Well it will, but it will quietly and quickly remove all the built packages before you can save them or install them. Yargghh. I wasted half a day trying to fix this one. 

Better to just build by hand:

$ ./configure --with-oci8=instantclient,/home/oracle/instantclient_11_1 

$ make

Fix any errors/warnings before continuing

Don't make install, which won't work.

$ cp ./modules/oci8.so /usr/lib/php5/20060613+lfs

Replace 20060613+lfs with whatever module directory has been setup for you in /usr/lib/php5

Create /etc/php5/conf.d/oci8.ini:

----

extension=oci8.so

----

Now run the php cmdline in verbose mode (php -v) and see if everything loaded. Fix it if it didn't.

You may need some env variables setup in your /etc/init.d/apache2 file to make everything work and actually execute queries, but a phpinfo() at this point should show your oci8 extension. See the php.net Oracle pages if you need help with the env variables.

Categories: PHP software
Comments? | More Actions Open/Close menu
Back
Adore, v.:
To venerate expectantly.
-- Ambrose Bierce, "The Devil's Dictionary"