Install Apache2 PHP5 OCI8 on Debian Etch

Filed Under (apache2, debian) by Coni on 30-11-2007

First install php5 pear and build essential alien. I used alien because I used rpm oracle-client version (It’s ligther to download).

# apt-get install php5 php-pear build-essential php5-dev alien

Download oracle client and sdk in http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
Choose oracle-instantclient-basic-10.2.0.3-1.i386.rpm and oracle-instantclient-devel-10.2.0.3-1.i386.rpm
I choose version 10.2.0.3 cause my job is in Oracle 10g. If you want to download 11.1.0.1 that’s ok.
Don’t forget to Accept License Agreement

Install oracle client an sdk using alien :

# alien -vi oracle-instantclient-basiclite-10.2.0.3-1.i386.rpm
# alien -vi oracle-instantclient-devel-10.2.0.3-1.i386.rpm

Let see where it’s installed :

# rpm -qpl oracle-instantclient-basiclite-10.2.0.3-1.i386.rpm
/usr/lib/oracle/10.2.0.3/client/bin/genezi
/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
/usr/lib/oracle/10.2.0.3/client/lib/libnnz10.so
/usr/lib/oracle/10.2.0.3/client/lib/libocci.so.10.1
/usr/lib/oracle/10.2.0.3/client/lib/libociicus.so
/usr/lib/oracle/10.2.0.3/client/lib/libocijdbc10.so
/usr/lib/oracle/10.2.0.3/client/lib/ojdbc14.jar

It’s showed where oracle instant client’s installed.

To install oci8 just use pecl for simple case and answer like I print it. I used oci8-1.2.3 because at this time the newest version is 1.2.4 and it’s unstable and some times cause segmentation fault in apache (See Apache error log).

# pecl install oci8-1.2.3.tgz
downloading oci8-1.2.3.tgz …
Starting to download oci8-1.2.3.tgz (83,591 bytes)
…..done: 83,591 bytes
10 source files, building
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
Please provide the path to ORACLE_HOME dir. Use ‘instantclient,/path/to/instant/client/lib’ if you’re compiling against Oracle Instant Client [autodetect] : instantclient,/usr/lib/oracle/10.2.0.3/client/lib
building in /var/tmp/pear-build-root/oci8-1.2.3
running: /tmp/pear/cache/oci8-1.2.3/configure –with-oci8=instantclient,/usr/lib/oracle/10.2.0.3/client/lib
checking for grep that handles long lines and -e… /bin/grep
checking for egrep… /bin/grep -E
…………
…………
…………
Build process completed successfully
Installing ‘/var/tmp/pear-build-root/install-oci8-1.2.3//usr/lib/php5/20060613+lfs/oci8.so’
install ok: channel://pecl.php.net/oci8-1.2.3
You should add “extension=oci8.so” to php.ini

Like it’s said add “extension=oci8.so” to /etc/php5/apache2/php.ini and restart apache2 :

# /etc/init.d/apache2 restart

Visit Yogyakarta / Jogja