Howto: PHP 5.2.5 + oci8

hehachris

Verified User
Joined
Nov 24, 2004
Messages
533
Location
Hong Kong
Purpose: To install oci8 extension for PHP 5.2.5

Tested Plaform: Centos 4, Apache 2.0, PHP 5.2.5 (suPHP)

1, We first need to install the Oracle Instant Client. This howto assumes that the instant client version is 11.1.0.1
Download the the Basic RPM and SDK RPM from http://www.oracle.com/technology/software/tech/oci/instantclient/index.html

2, Install the RPMs:
Code:
# rpm -Uvh oracle*.rpm

3, Set env variables by editing /etc/profile
Code:
# nano /etc/profile

Add:

Code:
export ORACLE_HOME=/usr/lib/oracle/11.1.0.1/client
export LD_LIBRARY_PATH=/usr/lib/oracle/11.1.0.1/client/lib:$LD_LIBRARY_PATH

Also run the those 2 lines directly in the shell.

4, We need to edit the PHP configure file as well...
Code:
# cd /usr/local/directadmin/custombuild
# cp -rp configure custom
# nano custom/suphp/configure.php5

Add "--with-oci8" without the quotes to the configure options, and add one more line at the bottom:

Code:
/usr/bin/perl -pi -e 's/EXTRA_INCLUDES =/EXTRA_INCLUDES = -I\/usr\/include\/oracle\/11.1.0.1\/client/' Makefile

The line above will include the extra header files during the make

5, Ready to build PHP 5
Code:
./build php5-cgi n

6, Check phpinfo() and see if oci8 loaded

That's it!
 
Last edited:
Back
Top