- Install Oracle instant client (the basic package and the SDK!). (You obviously need the 64bit version on a 64bit architecture). I tried doing this using my locally installed oracle express edition (XE) but that whas a whole lot of pain:
OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory
I ended up using oracle_instantclient_10_2 which worked!! - sudo -i
- apt-get install apache2 php5 php5-dev php-pear libaio1
- Make sure your $ORACLE_HOME and $LD_LIBRARY_PATH is set. Since I have 2 different versions of 'oracle' I set these two variables in /usr/sbin/apache2ctl, at the top of the 'CONFIGURATION SETION':
export ORACLE_HOME=/stuph/install/oracle_instantclient_10_2
export LD_LIBRARY_PATH=$ORACLE_HOME echo $ORACLE_HOME >> /etc/ld.so.conf
ldconfig
-
Check if the symlinks named libclntsh.so and libocci.so exist in $ORACLE_HOME, which we will need later. In my case these symlinks were not created by ldconfig, so I created them manually:
ln -s libclntsh.so.11.1 libclntsh.so; ln -s libocci.so.11.1 libocci.so
- pecl install oci8
To enable the oci8 module, add "extension=oci8.so" to /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini). (put this line after the examples starting with ; in the "Dynamic Extensions" section).
ldconfig
apache2ctl restart
(or/etc/init.d/apache2 force-reload
to make sure)- You should see the oci8 module in the output of phpinfo(). (put info.php in ~www-data or ~apache with the following content and browse to it: "<? phpinfo() ?>")
(I'm sorry if this assumes you know how to do certain stuff, but this is a howto for myself, so that I can remember how to do this in a mounth's time)