in reply to Access system ENV variables from within CGI Script

A much simpler solution is to use the following as your CGI script:

#!/bin/sh --login exec /path/to/real/script.cgi $@

Untested.