in reply to Access system ENV variables from within CGI Script
You also may need to explicitly add stuff to the Apache environment for your cgi script to see it. There's a directive name SetEnv or something like that (been a while since I looked). You will need to add any variables you want available to your cgi script that aren't already there.