Hi,

System:
        Win32
        PHP 5.2.0
        Apache 2.0.54 (PHP in CGI mode)

CGI vars are not automatically loaded into $_ENV global array. Only when calling getenv('var'), just then the variable appears in $_ENV. Besides, it seems that the env vars are loaded automatically into $_SERVER. And $HTTP_ENV_VARS is always NULL.


<?php
echo "before getenv...";
echo "<br>\$_ENV: "; var_dump($_ENV);
echo "<br>\$HTTP_ENV_VARS: "; var_dump($HTTP_ENV_VARS);

getenv('SERVER_PROTOCOL');
echo "<hr>after getenv...";
echo "<br>\$_ENV: "; var_dump($_ENV);
echo "<br>\$HTTP_ENV_VARS: "; var_dump($HTTP_ENV_VARS);
?>

=== output:
before getenv...
$_ENV: array(0) { }
$HTTP_ENV_VARS: NULL
--------------------------------------------------------------------------------
after getenv...
$_ENV: array(1) { ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" }
$HTTP_ENV_VARS: NULL


Is it a bug? Or this is the way it should work?


-thanks, Eli

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to