On Mon, 15 Jun 2009, Valentin Bud wrote:

On Mon, Jun 15, 2009 at 3:16 PM, Pieter Donche <pieter.don...@ua.ac.be>
      On Mon, 15 Jun 2009, Robert Huff wrote:
            Pieter Donche writes:
                   How can one change the PATH for the
                  user www ?
                   to include e.g. /usr/local/bin
                   In /etc/passwd the entry now is:
                   www:*:80:80:World Wide Web
                   Start by reading the section 5 man page for
                   Could you provide a little more detail about
            what's breaking
            and why you think this user's path is involved?
                                           Robert Huff
Some users on my system run scripts in their webpages. If they specify
commands (e.g.) 'python',  it is not found, unless it is specified as
'/usr/local/bin/python', since the Apache runs in an environment which
has as PATH: (as can be seen from phpinfo() output)
/sbin:/bin:/usr/sbin:/usr:bin only.

How can one make the PATH that Apache httpd deamon will use
be a different path? and where exaclty does it get
/sbin:/bin:/usr/sbin:/usr:bin from
in the first place?

I could try specifying in /usr/local/sbin/apachectl 's Bourne shell
export PATH

but wouldn't this be set back to the original at an Apache update?

root has a better path:

how could I have httpd have the same path?

Hello Pieter,

  I guess you are looking for apache's SetEnv directive:

(I use apache 2.2.11)
1. I noticed that when I do a # apachectl graceful
from within a root shell, then the PATH env. var. for Apache Environment
as reported by phpinfo() is equal to the PATH setting of my  root user.

Probably when rebooting the machine, PATH will be set to a very limited
/sbin:/bin:/usr/sbin:/usr/bin  (where does this come from?)

Now I see from reading the apache start-up script /usr/local/sbin/apachectl
that one can create a file with instructions to be executed at
startup of Apache: any file in /usr/local/etc/apache22/envvars.d is sourced into the start up environment of apache.

This directory was empty for the moment.
So I could put in there a file,
export PATH

# apachectl graceful
however this did not change the phpinfo() reported PATH, it remained the same as my root path

2. I also tried, as you suggested
# vi /etc/httpd.conf
SetEnv  TEST_ENV_VAR    foo-foo
SetEnv  PATH    /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
(the first SetEnv is just to see if it indeed sets Env. vars.)

# apachectl graceful
The TEST_ENV_VAR  foo-foo
is reported But again PATH remains the same as my root path.

Does this mean when executing # apachectl graceful from within a root shell
PATH will ALWAYS be overridden by the value of PATH of the root shell?

I don't see what rules of precedence acutally apply ...
Anyone can explain me?

And will SetEnv in /etc/httpd.conf also work at boot ???
Or will only /usr/local/etc/apache22/envvars.d/mysettings work at boot ??
Or will none of these work at boot ?

freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to