Skip to Main Content

Problem with env vars (ORACLE_HOME and LD_LIBRARY_PATH) in Linux server

943072Jun 12 2012 — edited Feb 21 2013
Hello all.

Let me introduce my problem with Oracle connection.

I currently have a Red Hat Enterprise Linux Server release 5.5.
This server is running php and will connect to a Unix server where Oracle DB is located.

After a lot of effort, including even altering selinux configuration, I achieved installing Oci8 extension in php (version 5.1.6) in Redhat server, but when executing a simple php test (including just oci_connect function), 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 /var/www/html/testoracle.php on line 6
not connected"

I have checked the values of ORACLE_HOME and LD_LIBRARY_PATH with a script containing phpinfo() function, and I confirmed that their values are correctly set in:
Apache Environment, oci8, Environment and PHP Variables tables.

Their values are /opt/oracle/oraclehome and /opt/oracle/oraclehome/lib respectively.
/opt/oracle/oraclehome is the folder where I had Oracle Client 10.2 installed.

I have also checked the oracle.conf file in /etc/ folder, and it point to /opt/oracle/oraclehome/lib too.

I have added user 'apache' to group 'oracle'.

I had Apache restarted, even the server restarted, but even now I keep getting the same error about Environment Variables.

Is there any ideas about what I could do to fix it?

Thank you in advance.
Post Details
Added on Jun 12 2012