httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leif W" <warp-...@usa.net>
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 
it.

> 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 
there.

> 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.

Leif

-----Original Message-----
From: Leif W [mailto:warp-9.9@usa.net]
Sent: Wednesday, January 05, 2005 2:57 PM
To: users@httpd.apache.org
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
for.

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.

Leif

----- Original Message ----- 
From: "Rob Brenart (TT)" <Rob.Brenart@tradingtechnologies.com>
To: <users@httpd.apache.org>
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
using
the User directive

I follow your suggestion and am trying to implement it, but can't find
the
location for envvars on my system (I don't have an existing one, and I
have
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
that
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
[mailto:Axel-Stephane.SMORGRAV@europe.adp.com]
Sent: Wednesday, January 05, 2005 12:22 PM
To: users@httpd.apache.org
Subject: RE: [users@httpd] Changing PATH

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.

Example:

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


-ascs

-----Message d'origine-----
De : Rob Brenart (TT) [mailto:Rob.Brenart@tradingtechnologies.com]
Envoyé : mercredi 5 janvier 2005 18:16
À : users@httpd.apache.org
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.

http://httpd.apache.org/docs/mod/mod_env.html#setenv

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
[mailto:Axel-Stephane.SMORGRAV@europe.adp.com]
Sent: Wednesday, January 05, 2005 11:01 AM
To: users@httpd.apache.org
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)

-ascs

-----Message d'origine-----
De : Rob Brenart (TT) [mailto:Rob.Brenart@tradingtechnologies.com]
Envoyé : mercredi 5 janvier 2005 17:56
À : users@httpd.apache.org
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 appreciated!

Thank you.



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message