Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a C CGI that is invoked by Apache, both running as SYSTEM.

The CGI relies on the setting of WINDIR and TEMPLATES environment variables. It gets the value of WINDIR without any problems but getenv("TEMPLATES") always returns NULL.

TEMPLATES is a system variable.

Another post Win Service running under LocalService account cannot access environment variables suggested rebooting, I tried this to no avail, and to make sure HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\ has the needed environment variable, it does.


share|improve this question

1 Answer 1

up vote 0 down vote accepted

Fixed this by adding a PassEnv directive to my Directory context:


Documentation here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.