Re: PHP CLI environment variables
| From: | Pierre-Alain Joye | Date: | Wed, 06 Nov 2002 12:54:21 +0000 |
| Subject: | Re: PHP CLI environment variables | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-90551@lists.php.net to get a copy of this message | ||
On Wed, 6 Nov 2002 13:30:03 +0100
Kjartan Mannes <kjartan@zind.net> wrote:
> I just tried using php-cli from the latest cvs and am a little
> confused by the placement of shell environment variables. $_ENV is
> empty, but the values are stored in $HTTP_SERVER_VARS and $_SERVER.
>
> Is this the proper behavior?
As far as I remember, this a knonw problem due to the variables order or
something like that. We ve got it in PEAR a few weeks ago, solved by
using a simple:
$foo = isset($_ENV['foo'])?$_ENV['foo']:getenv('foo');
See php4/pear/System.php function tmpdir() for others examples.
hth
pa