Re: getting $_ENV variables
| From: | Richard Lynch | Date: | Wed, 09 May 2007 17:49:36 +0000 |
| Subject: | Re: getting $_ENV variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-254674@lists.php.net to get a copy of this message | ||
On Wed, May 9, 2007 11:57 am, C.R.Vegelin wrote:
> I get nothing when using: echo $_ENV['OS'];
> Also nothing when using: print_r($_ENV);
> However, phpinfo(); show a full list of ENV settings.
> How to get $_ENV variables ?
> I am using PHP version 5.2.0.
If phpinfo() shows them, then that is what is there...
There's nothing magical about phpinfo() function.
It doesn't do much more than your print_r($_ENV)
So unless you are running your script in a *DIFFERENT* environment
(e.g., CLI or CGI versus Apache Module) you ought to see the same
things if you spell $_ENV correctly...
You can't even mess up variable scope, since it's a superglobal...
No, wait...
I think if you write it as a function and then declare $_ENV as
'global' you might actually manage to mess up and end up with your own
$_ENV instead of the real one... Never tried that, but it might
"break" it.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?