and then on the PHP interactive prompt, dump $_ENV and $_SERVER ?
We've noticed that depending on the PHP version and the way is called, sometimes the environment variable ends up in $_SERVER instead of $_ENV. This has been addressed recently in 1.8/develop.
Can you also check your php.ini? If it doesn't contain:
variables_order = "EGPCS"
or it is missing the "E", then the environment isn't populated. And the last possible issue that depending on PHP version, PHP type, and OS, an environment variable can end up in either $_ENV of $_SERVER (this doesn't seem to be your problem though). This issue will be addressed in 1.8.