I'm getting inconsistent behavior when using php's getenv. On my site's index page I set an environment variable using putenv. In other areas throughout the site I can get the variable back using getenv. Its all very simple and straightforward except for one area where it doesn't work.

Here's the code:


$widrootdir = getenv("WIDROOTDIR");

if ($widrootdir == "")
{
printf('<BODY bgcolor="#FFFFFF">');
printf('Configuration Error!!');
printf('</body></html>');
MYSQL_CLOSE();
exit;
}

Any ideas?!?