you should check your webserver configuration. if the server runs the scripts himself, the environment of the user running the server is asked.
some webserver have a feature which allows to run the cgi-scripts with the user privileges (roxen: just another checkbox, apache: suexec). in latter case the environment of the user hosting the script matters.