e2ka Posted June 10, 2006 Share Posted June 10, 2006 I compiled, installed PHP 5.1.4 with --with-oci8=instantclient,/usr/lib/oracle. The directory /usr/lib/oracle is where I dumped the oracle instant client libs and headers. I set the LD_LIBRARY_PATH and TNS_ADMIN env variables in /etc/httpd/conf.d/php.conf along with other stuff for setting up PHP...This was all working fine for a few days...Now all of a sudden when I load pages using oci8 I get the error:[code]Warning: oci_connect() [function.oci-connect]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries in /var/www/html/ecalconddb/db_functions.php on line 13[/code]I checked phpinfo() and LD_LIBRARY_PATH is still set to /usr/lib/oracle. After googling it seems that other problems of this type are related to permissions with the libraries, but everything looks fine to me:[code]# ls -l /usr/lib/oracle/total 101496-r--r--r-- 1 root root 1594191 Jun 10 06:26 classes12.jar-r--r--r-- 1 root root 1525 Jun 10 06:26 glogin.sqllrwxrwxrwx 1 root root 33 Jun 10 06:26 libclntsh.so -> /usr/lib/oracle/libclntsh.so.10.1-rwxr-xr-x 1 root root 18774535 Jun 10 06:26 libclntsh.so.10.1-r-xr-xr-x 1 root root 5623929 Jun 10 06:26 libnnz10.so-rwxr-xr-x 1 root root 1398088 Jun 10 06:26 libocci.so.10.1-rwxr-xr-x 1 root root 70690282 Jun 10 06:26 libociei.so-r-xr-xr-x 1 root root 119919 Jun 10 06:26 libocijdbc10.so-r-xr-xr-x 1 root root 1434235 Jun 10 06:26 libsqlplusic.so-r-xr-xr-x 1 root root 1053325 Jun 10 06:26 libsqlplus.so-r--r--r-- 1 root root 33230 Jun 10 06:26 nzerror.h-r--r--r-- 1 root root 85310 Jun 10 06:26 nzt.h-r--r--r-- 1 root root 11600 Jun 10 06:26 occiAQ.h-r--r--r-- 1 root root 38724 Jun 10 06:26 occiCommon.h-r--r--r-- 1 root root 73063 Jun 10 06:26 occiControl.h-r--r--r-- 1 root root 35218 Jun 10 06:26 occiData.h-r--r--r-- 1 root root 2115 Jun 10 06:26 occi.h-r--r--r-- 1 root root 29156 Jun 10 06:26 occiObjects.h-r-xr-xr-x 1 root root 7155 Jun 10 06:26 oci1.h-r--r--r-- 1 root root 10361 Jun 10 06:26 oci8dp.h-r--r--r-- 1 root root 410791 Jun 10 06:26 ociap.h-r-xr-xr-x 1 root root 6055 Jun 10 06:26 ociapr.h-r--r--r-- 1 root root 43225 Jun 10 06:26 ocidef.h-r-xr-xr-x 1 root root 4014 Jun 10 06:26 ocidem.h-r--r--r-- 1 root root 11331 Jun 10 06:26 ocidfn.h-r--r--r-- 1 root root 8954 Jun 10 06:26 ociextp.h-r--r--r-- 1 root root 150915 Jun 10 06:26 oci.h-r-xr-xr-x 1 root root 6638 Jun 10 06:26 ocikpr.h-r--r--r-- 1 root root 4351 Jun 10 06:26 ocixmldb.h-r--r--r-- 1 root root 19099 Jun 10 06:26 odci.h-r--r--r-- 1 root root 1540457 Jun 10 06:26 ojdbc14.jar-r-xr-xr-x 1 root root 6605 Jun 10 06:26 oratypes.h-r--r--r-- 1 root root 15031 Jun 10 06:26 orid.h-r--r--r-- 1 root root 102726 Jun 10 06:26 ori.h-r--r--r-- 1 root root 157674 Jun 10 06:26 orl.h-r--r--r-- 1 root root 42626 Jun 10 06:26 oro.h-r--r--r-- 1 root root 116591 Jun 10 06:26 ort.h-r-xr-xr-x 1 root root 8867 Jun 10 06:26 sqlplus-r-xr-xr-x 1 root root 9520 Jun 10 06:26 xa.h[/code]I even attempted to chmod 777 the whole directory but it still didn't work. I am now at a loss and hope someone can help me out!Cheers,-Rick Quote Link to comment Share on other sites More sharing options...
e2ka Posted June 10, 2006 Author Share Posted June 10, 2006 I have resolved the problem. I am not exactly sure why it didn't work the way I had it, but here's what I was doing wrong apparently.I had my LD_LIBRARY_PATH set in /etc/httpd/conf.d/php.conf with the SetEnv directives[code]# Oracle env variablesSetEnv TNS_ADMIN /afs/cern.ch/project/oracle/adminSetEnv LD_LIBRARY_PATH /usr/lib/oracle[/code]In phpinfo() I could see that these were set in both the "Environment" and "PHP Variables" sections.I removed those directives from php.conf and instead exported them into /etc/sysconfig/httpd[code]export LD_LIBRARY_PATH=/usr/lib/oracleexport TNS_ADMIN=/afs/cern.ch/project/oracle/admin[/code]This is what I was doing before, but for some reason I thought it would be cleaner if the vars were set in php.conf. By setting the vars this way they appear in the "Environment" section but not the "PHP Variables" section, and I can use oci8 without errors.I don't really know why one way works and not the other, but it seems it must have to do with the time the vars are visible to apache, perhaps oci8 is not loaded with the vars in the first case, and it fails without an error message?[!--quoteo(post=382340:date=Jun 10 2006, 04:06 PM:name=e2ka)--][div class=\'quotetop\']QUOTE(e2ka @ Jun 10 2006, 04:06 PM) [snapback]382340[/snapback][/div][div class=\'quotemain\'][!--quotec--]I don't really know why one way works and not the other, but it seems it must have to do with the time the vars are visible to apache, perhaps oci8 is not loaded with the vars in the first case, and it fails without an error message?[/quote]I tested the above theory by removing /etc/sysconfig/httpd and relying only on /etc/httpd/conf.d/php.confIf directives happen in this order:[code]LoadModule php5_module modules/libphp5.soSetEnv LD_LIBRARY_PATH /usr/lib/oracleSetEnv TNS_ADMIN /afs/cern.ch/project/oracle/admin[/code]Everything looks to be set up correctly but oci8 will not work. No error messages in the logs and no clues as to why things aren't working! (Is this a PHP bug?)If you have things in this order:[code]SetEnv LD_LIBRARY_PATH /usr/lib/oracleSetEnv TNS_ADMIN /afs/cern.ch/project/oracle/adminLoadModule php5_module modules/libphp5.so[/code]The setup appears the same in phpinfo() and everything works. Order matters! I hope this helps someone out in the future. Quote Link to comment Share on other sites More sharing options...
rjgoulet Posted February 27, 2007 Share Posted February 27, 2007 Regretabbly no, if using the 10g client, not instant client, you get the same error message and things don't work. Quote Link to comment Share on other sites More sharing options...
rjgoulet Posted February 27, 2007 Share Posted February 27, 2007 OK, allow me to add to my previous reply since I've corrected my problem. Cutting & Pasting code from one project into another is a significant time saver or waster depending on what you paste. In my case I pasted a very innocent and correct PutEnv statement into the PHP code that redefined ORACLE_HOME to a non-existent location. That caused the error. Therefore I would check my PHP code for PutEnv statements that contradict what envvars is setting and make sure the directories pointed to really exist and are correct. ::) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.