I'm relatively new to PHP and have run into a problem that has stumped me 
so I am hoping someone with more experience can help me out. 

I am attempting to run PHP v 5.2.2 on a Solaris 10 machine running Apache 
v2.2.4.  I have compiled PHP as a CLI instead of an Apache module because 
I need our students to be able to run scripts under their own user id's 
(suexec).  PHP is compiled using the following configure parameters:

./configure --prefix=/usr/local/php5 --with-openssl \
--with-oci8=instantclient,/usr/local/oracle/instantclient_10_2 \
--with-mysql=/usr/local/mysql --with-zlib-dir=/usr/local/lib \
--enable-fastcgi --enable-xslt --with-xslt-sablot --with-iconv \
--with-ldap --enable-force-cgi-redirect

This command was executed after installing the Oracle instantclient, 
OpenLDAP and MySQL.  Configure completes successfully as do both make and 
make install.  I am now able to run PHP scripts successfully that connect 
to our LDAP server and MySQL server.  The problem I am encountering occurs 
when I attempt to connect to an Oracle instance.  Any script I attempt to 
run generates this error message:

PHP Warning:  oci_connect() [<a 
href='function.oci-connect'>function.oci-connect</a>]: OCIEnvNlsCreate() 
failed. There is something wrong with your system - please check that 
LD_LIBRARY_PATH includes the directory with Oracle Instant Client 
libraries in /home/bu/jsantana/htdocs/OracleTest.php on line 10

My shell has LD_LIBRARY_PATH defined as:

LD_LIBRARY_PATH=/usr/local/oracle/instantclient_10_2:/usr/local/lib:/usr/lib:/usr/sfw/lib:/usr/sfw/libexec:/usr/local/apache2/lib

Which includes the path to the Oracle instantclient.  I have also edited 
Apache's envvars in $APACHE_HOME/bin so it includes the path to the Oracle 
client in it's LD_LIBRARY_PATH definition.  Neither change fixed the 
error.  My phpinfo(); shows that OCI8 support is enabled but I did notice 
that the path variable is returned as /usr/local/bin:/usr/bin:/bin.  Since 
this did not include the path to the Oracle client, I modified my test 
script to include the following code.

putenv('LD_LIBRARY_PATH=');
putenv('LD_LIBRARY_PATH=/usr/local/oracle/instantclient_10_2');
$val = getenv('LD_LIBRARY_PATH');
echo "Value: " . $val;

When I run the script now, I see that my LD_LIBRARY_PATH is set to the 
path that includes my Oracle instantclient files but I am still getting 
the error message I mentioned above.  This error occurs whether or not I 
am running in safe_mode. 

So now I am stumped.  Can anyone give me a hint as to what I am doing 
wrong here?  How can I get PHP v5 running as a CLI and get it to recognize 
the Oracle instantclient files installed on my system?

Thank you in advance for any help you can provide,

Jesse

Jesse Santana
Project Lead - Enterprise Services Group
Information Technology Services
California State University, Long Beach
1250 Bellflower Blvd.
Long Beach, CA  90840
Office: (562)985-8511
Fax:     (562)985-8855

Reply via email to