Jump to content

Recommended Posts

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.sql
lrwxrwxrwx    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
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 variables
SetEnv TNS_ADMIN /afs/cern.ch/project/oracle/admin
SetEnv 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/oracle
export 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.conf

If directives happen in this order:

[code]
LoadModule php5_module modules/libphp5.so
SetEnv LD_LIBRARY_PATH /usr/lib/oracle
SetEnv 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/oracle
SetEnv TNS_ADMIN /afs/cern.ch/project/oracle/admin
LoadModule 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.
  • 8 months later...
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. ::)
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.