Getting OCIEnvNlsCreate() failed from the web

Alles, was PHP betrifft, kann hier besprochen werden.

Getting OCIEnvNlsCreate() failed from the web

Postby zbee » 07. June 2012 17:53

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

Code: Select all
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


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.
Posts: 1
Joined: 07. June 2012 07:25
Operating System: Red Hat Linux

Return to PHP

Who is online

Users browsing this forum: No registered users and 28 guests