note 48758 added to ref.oci8

From: Date: Thu, 06 Jan 2005 09:05:53 +0000
Subject: note 48758 added to ref.oci8
Groups: php.notes 
Request: Send a blank email to php-notes+get-82833@lists.php.net to get a copy of this message
Hello once again. This time I present details on how to get Oracle Instant Client 10g ( 10.1.0.3 ), PHP 5.0.3 and Apache 2.0.52 running together on Linux (I've used fedora core 1 but I can't see why this will not work for any other distro ) *Note* This is not a guide on compiling php and httpd there are plenty of guides around to do that. This just covers compiling and using the oci8 module with php. 1. Set-up and install apache-2.0.52 as per normal 2. Unpack the Oracle 10g Instant Client ( 10.1.0.3 SDK + Basic, I also use the sqlplus pack to test the connection outside of apache / php ) rpm -ivh oracle-instantclient-basic-10.1.0.3-1.i386.rpm oracle-instantclient-devel-10.1.0.3-1.i386.rpm oracle-instantclient-sqlplus-10.1.0.3-1.i386.rpm 3. Set env ORACLE_HOME to the clients path in the current shell your shell command may vary (this is bash ) export ORACLE_HOME=/usr/lib/oracle/10.1.0.3/client; export LD_LIBRARY_PATH=/usr/lib/oracle/10.1.0.3/client/lib; (if you want to test if you can now get a connection to oracle using sqlplus see item 10 below.) 4. Unpack php-5.0.3 as per normal add in --with-oci8 to the configure options. If the ORACLE_HOME is set previously then adding the directory as per "--with-oci8=$ORACLE_HOME" should not be necessary. Do this to be safe though. 5. Run the ./configure program in php source directory. Don't make it just yet though. 6. The compiler needs to find the includes oci.h + others so, from the default client install dirs, I needed to edit the php Makefile after it was configured. Open it up and look for "EXTRA_INCLUDES" and add to end of line -I/usr/include/oracle/10.1.0.3/client (thats a capital i ) save the Makefile, then finish off compiling and installing php. Please note im sure this will be changed in php's configure so it finds these by default in the not too distant future. 7. Create a directory /etc/oracle and place your tnsnames.ora file in there, (VERY IMPORTANT make sure you chmod your tnsnames.ora to ensure that whatever username your httpd server runs under can read the file (1.5 hours of frustration later i figured this out). I just did "chmod 0644 tnsnames.ora" it doesn't matter where you put this as long as you set the env TNS_ADMIN to it. (IMPORTANT TNS_ADMIN points to a directory not the actual tnsnames.ora file ) 8. My system uses a /etc/init.d/httpd script to start up httpd so in that file I exported the ORACLE_HOME & TNS_ADMIN env vars before the httpd is run, oh you will need to set LD_LIBRARY_PATH as well if you not added the path to ld.so.conf export ORACLE_HOME=/usr/lib/oracle/10.1.0.3/client; export TNS_ADMIN=/etc/oracle 9. start httpd and bobs your uncle.... 10. You can test connection once the instant client rpm's are installed by using sqlplus. set ORACLE_HOME as above, TNS_ADMIN as above, LD_LIBRARY_PATH as above and if necessary. Then sqlplus <username>/<password>@<sid or service_name as per tns_admin file> use sqlplus here as you would normally Mark PS: Thanks Oracle for the SDK, about time ! ---- Manual Page -- http://www.php.net/manual/en/ref.oci8.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48758 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48758&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48758&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48758&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48758&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48758&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48758&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48758&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#82833) next »