Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting OCIEnvNlsCreate() failed from the web

942156Jun 7 2012 — edited Aug 28 2012
I've been trying to configure the oci extension on a Linux (Red Hat Enterprise) box with apache2. I finally got the extension to work. On my phpinfo() I can see that the extension is loaded. However, when I try to make a connection to a DB, I get the following error:

Warning: oci_connect() [function.oci-connect]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and LD_LIBRARY_PATH are set and point to the right directories in


Now, since the error talks about environment varibles, I've set these prior to running the script. If I do

export ORACLE_HOME=/ora01/app/oracle/product/10.2.0/db_1

Then the script will run and connect to the DB, but only if I run the script from the command line. I've tried several ways to set the environment variables within Apache itself or within PHP, but they just won't work. Even when PHP tells me that the environment variables are set correctly, it still won't work on the web. I've tried doing the export prior to starting up apache. I've also modified the apachectl script to set the environment variables. I've also modified the envvars file. And last, I tried modifying it through apache within the httpd.conf


SetEnv ORACLE_HOME /ora01/app/oracle/product/10.2.0/db_1
SetEnv LD_LIBRARY_PATH /ora01/app/oracle/product/10.2.0/db_1/lib

PassEnv LD_LIBRARY_PATH
PassEnv ORACLE_HOME


but with no luck. On The Underground PHP and Oracle Manual from Oracle, it states
...The important thing is to set the environment before Apache loads any Oracle library...
which is what I'm thinking the problem is, because I can make it work on the command line but not on the web. Any help will be greatly appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 25 2012
Added on Jun 7 2012
2 comments
1,090 views