Why is www's $PATH only /usr/bin:/bin?
lists at bertram-scharpf.de
Wed Apr 27 12:12:21 UTC 2016
On Tuesday, 26. Apr 2016, 21:40:48 +0200, Niklaas Baudet von Gersdorff wrote:
> I figured that www's $PATH is only /usr/bin:/bin. Why is that if
> /etc/login.conf says the following?
> :path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\
> The thing is that I want to run something in /usr/local/bin with PHP's
> but that's not working because it's not in $PATH.
I wondered as well about this behaviour sometimes. The
default path from login.conf will be set at login. Yet, the
www daemon is started from rc and this is not understood to
be a login. The perverse thing is that when you do a
"/usr/local/etc/rc.d/apache24 restart" from the command
line, then the PATH variable will contain the value you
I recommend to include a line into your Apache configuration
(or whichever HTTP server you use) like
SetEnv PATH /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
Cron does the same by "PATH=..." as you can see in
"/etc/crontab". There is no possibility to do this in lpd,
wherefore I wrote a bug report. Have a look at the
More information about the freebsd-questions