Hi,
If you are using Apache, you could take a look at mod_env
It will allow you to use the SetEnv
directive in Apache's configuration (and in .htaccess files, if your Apache server is configured so you can use those), like this :
In my Apache's file :
<VirtualHost *>
ServerName tests
DocumentRoot /home/squale/developpement/tests
....
SetEnv MY_TEST_VARIABLE "Hello, World!"
....
</VirtualHost>
(Require's an Apache restart to be taken into account)
Or in an .htaccess file :
SetEnv MY_OTHER_TEST_VARIABLE "This is looking nice !"
(Immediatly taken into account)
And, then, these variables are available in $_SERVER
:
var_dump($_SERVER);
Gives me :
array
'MY_TEST_VARIABLE' => string 'Hello, World!' (length=13)
'MY_OTHER_TEST_VARIABLE' => string 'This is looking nice !' (length=22)
'HTTP_HOST' => string 'tests' (length=5)
'HTTP_USER_AGENT' => string 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090716 Ubuntu/9.04 (jaunty) Shiretoko/3.5.1' (length=105)
'HTTP_ACCEPT' => string 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' (length=63)
'HTTP_ACCEPT_LANGUAGE' => string 'en-us,en;q=0.5' (length=14)
....
....
It's not $_ENV
like you requested... But almost ;-)
And the idea is really the same ^^