note 40748 modified in oci8.setup by sixd
| From: | sixd@php.net | Date: | Fri, 26 Jun 2009 18:24:49 +0000 |
| Subject: | note 40748 modified in oci8.setup by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157565@lists.php.net to get a copy of this message | ||
PHP Oracle -- Compiling Oracle Support into PHP, Apache 2
Apache 2.0.48, Php 4.3.4, Red Hat Linux 9.0, Debian 3.0, Oracle 9i R2
Dave Darden � 1/17/04 -- www.dardensystems.com
First install Apache 2 from source. Instructions are at http://httpd.apache.org/docs-2.0/install.html.
I used a --prefix=/usr/local/apache on the install.
Install Oracle. There is a very good Oracle install to RedHat 9.0 white paper at http://www.dizwell.com/ that goes step by step through the
problems (Oracle is not supported on RedHat 9. Oracle only supports installation on paid versions
of Red Hat).
If only an Oracle client is installed on the web server (if the database is on another machine in a
multi-tier configuration) then you must install both the client and the Oracle Call Interface (OCI).
I think SQLPlus also needs to be installed. Oracle Network Utilities and Installation Common Files
were also installed. If you cannot configure/make php because of missing Oracle library errors
during configure/make, then investigate whether you have installed enough of the �client�
pieces of Oracle on the web server machine.
I also included a link from libclntsh.so.8.0 to libclntsh.so.9.0 in the $ORACLE_HOME/lib
directory. Some internet posts suggested it to prevent errors in php configure/make. A later
experience moving from RedHat to Debian confirms that it is necessary to avoid a make error on a
missing lclntsh file.
In transferring the client software from a Red Hat 9.0 web server installation to a Debian 3.0
(kernel 2.4.18) web server installation I was able to simply copy over the Oracle /u01 directory
tree without rerunning the Oracle client installation. This must be done before php is configured
and compiled on the Debian machine so the oci8 libraries are available. And of course the tips on
libclntsh and environment variables must be observed as well.
Get the php source. This php configure line worked for me, creating an Apache 2 module, and keeping
mysql and gd support. Add other options if you need them for a given site. For some reason, even
though gd is included with php now, zlib was needed to successfully configure and make php from
source when including gd. You will need to substitute appropriate directory locations for your
install of Apache, zlib, and Oracle.
./configure --with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql --with-gd \
--with-zlib-dir=/usr/local \
--with-config-file-path=/etc \
--enable-force-cgi-redirect --disable-cgi \
--with-oci8=/u01/app/oracle/9i --enable-sigchild
Use an absolute path on -�with-oci8=/u01/app/oracle/9i
(Do not use the $ORACLE_HOME path variable in the configure statement. For some reason it does not
work even when it is set properly.)
Also, set the environment variables in
/usr/local/apache/bin/envvars like so (your env var values should vary):
export ORACLE_SID="lx92"
export ORACLE_HOME="/u01/app/oracle/9i"
export TNS_ADMIN="/u01/app/oracle/9i/network/admin"
export LD_LIBRARY_PATH="/u01/app/oracle/9i/lib"
export TNS_ADMIN="/u01/app/oracle/9i/network/admin/tnsnames.ora"
export TWO_TASK="/u01/app/oracle/9i/network/admin/tnsnames.ora"
export NLS_LANG="English_America.WE8ISO8859P1"
export ORACLE_BASE="/u01/app/oracle"
--was--
PHP Oracle -- Compiling Oracle Support into PHP, Apache 2
Apache 2.0.48, Php 4.3.4, Red Hat Linux 9.0, Debian 3.0, Oracle 9i R2
Dave Darden � 1/17/04 -- www.dardensystems.com
First install Apache 2 from source. Instructions are at http://httpd.apache.org/docs-2.0/install.html.
I used a --prefix=/usr/local/apache on the install.
Install Oracle. There is a very good Oracle install to RedHat 9.0 white paper at http://www.dizwell.com/ that goes step by step through the
problems (Oracle is not supported on RedHat 9. Oracle only supports installation on paid versions
of Red Hat).
If only an Oracle client is installed on the web server (if the database is on another machine in a
multi-tier configuration) then you must install both the client and the Oracle Call Interface (OCI).
I think SQLPlus also needs to be installed. Oracle Network Utilities and Installation Common Files
were also installed. If you cannot configure/make php because of missing Oracle library errors
during configure/make, then investigate whether you have installed enough of the �client�
pieces of Oracle on the web server machine.
I also included a link from libclntsh.so.8.0 to libclntsh.so.9.0 in the $ORACLE_HOME/lib
directory. Some internet posts suggested it to prevent errors in php configure/make. A later
experience moving from RedHat to Debian confirms that it is necessary to avoid a make error on a
missing lclntsh file.
In transferring the client software from a Red Hat 9.0 web server installation to a Debian 3.0
(kernel 2.4.18) web server installation I was able to simply copy over the Oracle /u01 directory
tree without rerunning the Oracle client installation. This must be done before php is configured
and compiled on the Debian machine so the oci8 libraries are available. And of course the tips on
libclntsh and environment variables must be observed as well.
Get the php source. This php configure line worked for me, creating an Apache 2 module, and keeping
mysql and gd support. Add other options if you need them for a given site. For some reason, even
though gd is included with php now, zlib was needed to successfully configure and make php from
source when including gd. You will need to substitute appropriate directory locations for your
install of Apache, zlib, and Oracle.
./configure --with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql --with-gd \
--with-zlib-dir=/usr/local \
--with-config-file-path=/etc \
--enable-force-cgi-redirect --disable-cgi \
--with-oci8=/u01/app/oracle/9i --enable-sigchild
Use an absolute path on -�with-oci8=/u01/app/oracle/9i
(Do not use the $ORACLE_HOME path variable in the configure statement. For some reason it does not
work even when it is set properly.)
Also, set the environment variables in
/usr/local/apache/bin/envvars like so (your env var values should vary):
export ORACLE_SID="lx92"
export ORACLE_HOME="/u01/app/oracle/9i"
export TNS_ADMIN="/u01/app/oracle/9i/network/admin"
export LD_LIBRARY_PATH="/u01/app/oracle/9i/lib"
export TNS_ADMIN="/u01/app/oracle/9i/network/admin/tnsnames.ora"
export TWO_TASK="/u01/app/oracle/9i/network/admin/tnsnames.ora"
export NLS_LANG="English_America.WE8ISO8859P1"
export ORACLE_BASE="/u01/app/oracle"
http://php.net/manual/en/oci8.setup.php