Wanted to work on an Oracle project from home last weekend, but I received this message:
Warning (2): ocilogon() [function.ocilogon]: 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 [CORE/cake/libs/model/datasources/dbo/dbo_oracle.php, line 171]
A little bit of system background here. I’m using Linux Mint 8, running oracle-xe 10.2.0.1-1.1. oci8 was compiled via pecl, with one notable difference from my previous guide. I did not use instantclient (i.e. instantclient,/usr/lib/oracle/11.1/client/lib), so the phpinfo output for the oci8 section was quite different.
It looked like:
OCI8 Support enabled
Revision $Revision: 293235 $
Active Persistent Connections 0
Active Connections 0
Compile-time ORACLE_HOME /usr/lib/oracle/xe/app/oracle/product/10.2.0/server
Libraries Used -Wl,-rpath,/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib -L/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib -lclntsh
Temporary Lob support enabled
Collections support enabled
I did some searching. I figured it was something to do with environment variables, as my colleague had helped me to resolve the problem previously. I’d forgotten the fix, so this post will serve as a reminder, if needed.
Now ORACLE_HOME and LD_LIBRARY_PATH were defined via my .bashrc, which consists of just one line:
echo $ORACLE_HOME /usr/lib/oracle/xe/app/oracle/product/10.2.0/server echo $LD_LIBRARY_PATH /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib:
Some people suggested using Apache’s SetEnv — which I tried — but the error did not go away. That same colleague suggested this morning I use the envvars file in Ubuntu instead, which helped to resolve my problem, at least:
Adding these two lines solves my problem:
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server export LD_LIBRARY_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib:
Seriously, my journey with Oracle has always been a rocky one. I wonder why this product is so… inaccessible.