Setting up an Oracle / PHP connection

Connecting to Oracle from PHP:

Download the oracle instant client basic and devel files:

oracle-instantclient-basic-10.2.0.3-1.i386.rpm and
oracle-instantclient-devel-10.2.0.3-1.i386.rpm

from the oracle website and install them:

# rpm -i oracle-instantclient-basic-10.2.0.3-1.i386.rpm 
# rpm -i oracle-instantclient-devel-10.2.0.3-1.i386.rpm

Download and unpack the latest version of PHP source from php.net

run this to configure php (apache2):

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-oci8=instantclient,/usr/lib/oracle/10.2.0.3/client/lib 
--enable-soap --with-zlib --enable-mbstring=all --with-iconv --enable-sigchild

if you get this error: checking Oracle Instant Client SDK header directory… configure: error: Oracle Instant Client SDK header files not found it means your oracle devel package didnt install correctly.

then run

# make
# make install

If you are having issues using oci_pconnect (causing apache segmentation faults) then you will need to use –with-oci8=shared,instantclient,/usr/lib/oracle/10.2.0.3/client/lib and install the 1.3.0 version of the OCI client from http://pecl.php.net/package/oci8

www.oracle.com/technology/pub/articles/oracle_php_cookbook/coggeshall_persist.html

Leave a Reply

Your email address will not be published. Required fields are marked *