OCIEnvNlsCreate() failed again

So I’ve downloaded and installed Fedora 12 for the work laptop for awhile now. Previously it was Linux Mint 7/8, but I haven’t actually used the machine yet, as I encountered that darned OCIEnvNlsCreate() error message again. Same setup, just Oracle Express 10 on Linux, except the distro is Fedora this time.

So I was looking for a place to set environment variables — Apache’s SetEnv directive DOES NOT work — and there is no equivalent of Debian’s /etc/apache2/envvars in Fedora, at least I’m told. The weird thing is, plenty of people have encountered the problem before, but never found the solution — or didn’t bother to post the solution online.

I finally found the solution in an Oracle-hosted article about Oracle, PHP and Linux. It’s not really well-described, so I thought to post my solution here instead. Insert the call to oracle_env.sh somewhere in /etc/init.d/httpd. I put mine above the start() function definition:

. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

oracle_env.sh file should contain something similar to the following:

ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export ORACLE_HOME
ORACLE_SID=XE
export ORACLE_SID
NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export NLS_LANG
PATH=$ORACLE_HOME/bin:$PATH
export PATH
if [ $?LD_LIBRARY_PATH ]
then
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
else
LD_LIBRARY_PATH=$ORACLE_HOME/lib
fi
export LD_LIBRARY_PATH

Once you’re done, save the file (you need to be root) and then restart httpd:

sudo /etc/init.d/httpd restart
Advertisements

4 thoughts on “OCIEnvNlsCreate() failed again

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s