httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Axel-Stéphane SMORGRAV <>
Subject RE: [users@httpd] Changing PATH
Date Wed, 05 Jan 2005 18:22:10 GMT
I made some tests and found that the PATH and TZ variables seem to be passed by default - no
passenv needed. The value of the PATH variable is that of the environment in which the server
is started. "SetEnv PATH /foobar", although not giving any errors on my Solaris system, does
nothing, which is just as well...

So if you do :
$ PATH=/foobar ; export PATH
$ /usr/local/httpd/bin/httpd -f /usr/local/httpd/conf/httpd.conf -k start

the value of the PATH environment variable passed to CGI scripts should be "/foobar". If you
have a "vanilla" installation, you can check the values of all environment variables passed
to a CGI script by requesting http://myhttpdhost/cgi-bin/printenv.

So now, back to your problem.

You say that you are running Apache as a user on your system. Since not really understanding
exactly what you mean by that, I guess that you either start and run Apache as a non-privileged
user and hence do not bind the default ports (80,443), or you start Apache as root but run
it as a different user (User directive) and expect the process to inherit from the variables
defined in that users' .profile/.cshrc or other rc.

In either case, the PATH environment variable cannot possibly be configured correctly in the
shell environment in which the server is started, otherwise it would have been available to
your CGI script with the correct value.

I suggest you make sure that apachectl is used to start Apache. Then modify /usr/local/httpd/bin/envvars
(replace /usr/local/httpd by the path where you installed Apache) so that the PATH environment
variable is set correctly and exported prior to spawning the httpd process. Then verify that
it is actually set correctly by requesting http://myhttpdhost/cgi-bin/printenv. 


You can for example add the following line to /usr/local/httpd/bin/envvars:
PATH=$PATH:/foobar ; export PATH
(replace /foobar with whatever path you need...)

Then start the Apache server with the command (the $ is a shell prompt):
$ /usr/local/httpd/bin/apachectl start


-----Message d'origine-----
De : Rob Brenart (TT) [] 
Envoyé : mercredi 5 janvier 2005 18:16
À :
Objet : RE: [users@httpd] Changing PATH

I mean that on the start of the webserver I would like to set an environment variable which
is then passed to CGI scripts and SSI pages. As described here.

However, this doesn't work for the PATH variable.

I did not have any PassEnv directives set, but I do not believe they're necessary here as
the PATH variable is already passed on, just not with my expected values... and also, SetEnv'ing
a new variable passes it on just fine.

But I tried setting a PassEnv directive with no change to the behavior.

-----Original Message-----
From: Axel-Stéphane SMORGRAV []
Sent: Wednesday, January 05, 2005 11:01 AM
Subject: RE: [users@httpd] Changing PATH

Do you mean that you want to be able to set the path variable dynamically??

Have you specified an apropriate PassEnv directive in you configuration (/manual/mod/mod_env.html#passenv
in the Apache 2 manual pages)


-----Message d'origine-----
De : Rob Brenart (TT) []
Envoyé : mercredi 5 janvier 2005 17:56
À :
Objet : Changing PATH

Running Debian Sarge
Apache 1.3.33

I need to change the value of the PATH variable sent to my PHP scripts

I enabled mod_env and tried to the SetEnv PATH method, only to learn that the PATH and TZ
variables cannot be set this way.

I'm already running apache as a user on my system rather than as the www-data user, but it's
not inheriting that users path.

I cannot seem to find another method for changing the path variable... any help would be greatly

Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message