Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jun 2009 08:49:38 -0800
From:      Mel Flynn <mel.flynn+fbsd.questions@mailing.thruhere.net>
To:        freebsd-questions@freebsd.org, Pieter Donche <Pieter.Donche@ua.ac.be>
Cc:        Robert Huff <roberthuff@rcn.com>, Valentin Bud <valentin.bud@gmail.com>
Subject:   Re: path for user www
Message-ID:  <200906150849.39244.mel.flynn%2Bfbsd.questions@mailing.thruhere.net>
In-Reply-To: <alpine.BSF.2.00.0906151556400.45918@macos.cmi.ua.ac.be>
References:  <alpine.BSF.2.00.0906151131390.34405@macos.cmi.ua.ac.be> <139b44430906150524i70940c6dp2fbc8c22ffd9e55@mail.gmail.com> <alpine.BSF.2.00.0906151556400.45918@macos.cmi.ua.ac.be>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 15 June 2009 06:15:11 Pieter Donche wrote:

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

Nope, you didn't read it right.

> This directory was empty for the moment.
> So I could put in there a file,
> /usr/local/etc/apache22/envvars.d/mysettings
> PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
> export PATH

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

It will never work:
1) Your file needs to end in .env.
2) graceful does not restart the root process and the environment is kept in 
the root httpd process, thus you need to restart apache.

% alias aprestart
aprestart='sudo /usr/local/etc/rc.d/apache22 restart'

% cat /usr/local/etc/apache22/envvars.d/path.env
#!/bin/sh
export PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

% aprestart
Performing sanity check on apache22 configuration:
Syntax OK
Stopping apache22.
Waiting for PIDS: 85453.
Performing sanity check on apache22 configuration:
Syntax OK
Starting apache22.

% curl -s http://localhost/info.php |sed -ne '/PATH / s,<[^>]*>,,gp' |head -1
PATH /sbin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

-- 
Mel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906150849.39244.mel.flynn%2Bfbsd.questions>