Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to setup a local development box. The box's on Linux Mint. Installed apache, php and mysql without any problem, then I proceeded to install Oracle Xpress Edition as my newest project requires.

Obtained the through pecl and modified php.ini.

The problem is, everytime I reboot and tries to connect to oracle using oci_connect() call, it will give me this error:

oci_connect() [function.oci-connect]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory 

I've already checked the ORACLE_HOME at the time the error arises and it seems to contain the correct value.

Now, I can get around this problem by going to terminal and

$ su
$ apache2ctl stop
$ apache2ctl start

That's the ONLY way of getting it fixed (i.e. not sudo apache2ctl restart, not sudo apache2ctl {stop,start}, not su apache2ctl restart).

I know this is a minor problem and I could probably live with it. But if someone out there can point me on getting this work, I'd very much appreciate it.

share|improve this question
up vote 0 down vote accepted

Another option is to set ORACLE_HOME in the apache httpd.conf or in the virtual host that uses it.


SetEnv ORACLE_HOME "/path/to/oracle/home"

to httpd.conf (or inside the virtual host config file /etc/apache2/hosts-enabled/...)

That has the advantage of not needing to mess up with system scripts.

share|improve this answer
That works like charm! Silly me should of thought of that. Thank's =D – andreas Aug 29 '09 at 4:57

It sounds like the init script that starts Apache doesn't have the correct environment variables set (the script probably lives somewhere in /etc/init.d). It works when you manually restart it, because your shell has the ORACLE_HOME set properly, which gets passed on to Apache.

The solution is to modify Oracle's system startup script to set the ORACLE_HOME environment variable. It may even have some way to set external variables automatically (on Red Hat style systems, most init scripts source files in /etc/sysconfig, so you should take a look into the init script to see if it sources files from somewhere. That way if you upgrade Oracle and that updates the init script, your changes won't get blown away).

share|improve this answer
I tried setting the env vars on oracle startup script, but the problem persists. =(, any more ideas? – andreas Aug 20 '09 at 3:33

I've seen it caused by SELinux. I had to temporarily disable SELinux to install the Oracle drivers, then when I rebooted, the Oracle drivers weren't loaded. The Apache logs indicated this with:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/' - cannot enable executable stack as shared object requires: Permission denied in Unknown on line 0

According to this helpful page, you can tell SELinux to permit the Oracle drivers with:

execstack -c /usr/lib64/php/modules/

You can also take the more radical step of disabling SELinux entirely. In /etc/selinux/config, change "SELINUX=enforcing" to "SELINUX=disabled"

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.