Why is my $_ENV empty?

Crypto007

New Member
I'm running \[code\]Apache/2.2.11 (Win32) PHP/5.3.0\[/code\] and I did the following in my .htaccess file:\[code\]SetEnv FOO bar\[/code\]If I print out the \[code\]$_ENV\[/code\] variable in a PHP file, I get an empty array. Why doesn't my environment variable appear there? Why is it empty in the first place?I did find my variable though, but it appears in the \[code\]$_SERVER\[/code\] variable. And for some reason it appears twice, sort of. Why is this?\[code\][REDIRECT_FOO] => bar[FOO] => bar\[/code\]It appears I can get it using \[code\]getenv('FOO')\[/code\], so maybe I should just use that instead. But I am still a bit curious to what causes this. Is this a Windows issue? Or what is going on?Update: Discovered that the \[code\]$_ENV\[/code\] array wasn't populated because of a setting in php.ini:\[code\]; This directive determines which super global arrays are registered when PHP; starts up. If the register_globals directive is enabled, it also determines; what order variables are populated into the global space. G,P,C,E & S are; abbreviations for the following respective super globals: GET, POST, COOKIE,; ENV and SERVER. There is a performance penalty paid for the registration of; these arrays and because ENV is not as commonly used as the others, ENV is; is not recommended on productions servers. You can still get access to; the environment variables through getenv() should you need to.; Default Value: "EGPCS"; Development Value: "GPCS"; Production Value: "GPCS";; http://php.net/variables-ordervariables_order = "GPCS"\[/code\]If I set that back to the default value, I get stuff in \[code\]$_ENV\[/code\]. However the FOO value still doesn't appear there...
 
Back
Top