How set Environment variable

Hi, I need to set some env variables, but seems that the file


is not the correct place: I add in such file something like


(or with export ) but the phpinfo() does not report it.

If I add inside the php script something like putenv("TNS_ADMIN=/usr/lib/oracle/11.2/client64/network/admin"); all goes on.

May be there is a more virtual server specific site?


Giulio Carabetta



Howdy -- can you describe how this particular environment variable would work, or what component/app it is that would need access to it?

PHP may not have access to environment variables set during the Apache startup though. If it's a PHP app that needs it we'd probably need to set that elsewhere.

the env variables are needed for the OCI8 / Oracle instant client to correct find libs and other definition files (like tnsnames.ora).

A long time ago I found a workaround putting them in the /etc/init.d/httpd startup script, so the /etc/sysconfig/httpd seems to be the correct place, but it does not work, just like it is not exported to child processes.

I'm "just" looking for a method (the more correct) to add a pair name=value in the Environment section of the phpinfo() (oviously, called via http).