httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leif W" <>
Subject Re: [users@httpd] Changing PATH
Date Thu, 06 Jan 2005 06:43:45 GMT
> Rob Brenart (TT); 2005 January 05 Wednesday 17:27
> Unfortunately that's not taking me anywhere useful...

If the question you had was "where is my apache bin folder", then this 
is one way you find it.  Another way, maybe simpler, is "type -a 
apachectl".  It should say /var/httpd/bin/apachectl or 
/usr/local/apache/bin/apachectl or something.  Then you just cd to that 
location, minus the trailing filename.  cd /var/httpd/bin or cd 
/usr/local/apache/bin and so on.

> Does anyone know with apache 1.3.33 on Debian Sarge where the envvars 
> file
> goes?  This is killing me... seems so promising, but I can't get it to 
> go...

Well, I have never used the envvars file before, so I have no idea about 

> can't even really know if it's trying and failing or not going, is 
> there any
> way I can find out if it's even trying to load my envvars file?

Perhaps by running "lsof | grep envvars" repeatedly after starting 
apache, perhaps on the same command line.  Perhaps my making the envvars 
file fail on purpose, to see if Apache responds differently.  For 
instance, a symlink to a file which does not exist.  But eventually, the 
true test is wether or not it appears when you hit a CGI script and 
output all the environment variables, such as the "printenv" script. 
Regardless of language, they should have some environment variables 

> Changing the PATH as root, then stop and starting using apachectl 
> worked
> wonderfully!  But, this obviously won't stick on a reboot or some 
> such.
> Perhaps I'll just permanently change roots PATH?

Hmm, well, you could change apachectl's path, or just ADD one.  You 
could change (or add) the PATH to /etc/init.d/httpd or whatever your 
Apache startup script is named.  Or as you say, you could change root's 
PATH (/root/.bashrc) or the system-wide path (/etc/profile) or whatever 
their names are.  Obviously, you want to limit the path to generic 
locations as much as possible on a system-wide or root level, so I'd 
look elsewhere.


-----Original Message-----
From: Leif W []
Sent: Wednesday, January 05, 2005 2:57 PM
Subject: Re: [users@httpd] Changing PATH

One way to locate stuff on Debian is to build a database of all file
paths with the "updatedb" command, and then query that database with the
"locate" command.  Note that updatedb can be I/O intensive, and can take
several minutes to run.  It can be run by cron every night or every few
days.  Just try the locate command first, and it will warn you if the
database is older than 7 days, in which case the locations may be stale,
and you should run updatedb if you didn't find what you were looking

locate httpd
cd /path/to/apache/bin

or run

updatedb &

and repeat the locate.

The other way is to query the packages, but I'm not so good at that, and
have no Debian in front of me to test.


----- Original Message ----- 
From: "Rob Brenart (TT)" <>
To: <>
Sent: 2005 January 05 Wednesday 15:19
Subject: RE: [users@httpd] Changing PATH

What I mean was your second choice... that I'm starting it as root and
the User directive

I follow your suggestion and am trying to implement it, but can't find
location for envvars on my system (I don't have an existing one, and I
neither an httpd/bin or apache/bin anywhere on my system... the
drawbacks of
apt-get are figuring these things out sometimes)... but I'm researching
for my distro and will hopefully have this resolved soon.

Thanks for your help, I'll let you know what happens.

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

I made some tests and found that the PATH and TZ variables seem to be
by default - no passenv needed. The value of the PATH variable is that
the environment in which the server is started. "SetEnv PATH /foobar",
although not giving any errors on my Solaris system, does nothing, which
just as well...

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

the value of the PATH environment variable passed to CGI scripts should
"/foobar". If you have a "vanilla" installation, you can check the
values of
all environment variables passed to a CGI script by requesting

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
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
variables defined in that users' .profile/.cshrc or other rc.

In either case, the PATH environment variable cannot possibly be
correctly in the shell environment in which the server is started,
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
/usr/local/httpd/bin/envvars (replace /usr/local/httpd by the path where
installed Apache) so that the PATH environment variable is set correctly
exported prior to spawning the httpd process. Then verify that it is
actually set correctly by requesting


You can for example add the following line to
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
variable which is then passed to CGI scripts and SSI pages. As described

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
expected values... and also, SetEnv'ing a new variable passes it on just

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

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
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...
help would be greatly appreciated!

Thank you.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message