Date: Mon, 29 Dec 2008 12:05:26 -0900 From: Mel <fbsd.questions@rachie.is-a-geek.net> To: freebsd-questions@freebsd.org, bseklecki@collaborativefusion.com Cc: Bill Moran <wmoran@collaborativefusion.com> Subject: Re: Default list of exported variables in sh(1) - $HOSTNAME Message-ID: <200812291205.26505.fbsd.questions@rachie.is-a-geek.net> In-Reply-To: <1230581553.19488.7.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> References: <1230146554.4673.265.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> <200812271028.11339.fbsd.questions@rachie.is-a-geek.net> <1230581553.19488.7.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 29 December 2008 11:12:33 Brian A. Seklecki wrote: > > > SSH_CONNECTION > > > FTP_PASSIVE_MODE > > > EDITOR > > > > I suspect linux to set them from .profile files (even /etc/profile) and > > not hardcoded in a shell or login program. The default skeletons > > Mel: > > You were right to some extent. However, the problem is more > complicated (or less complicated, depending). > > First, FreeBSD's default php.ini doesn't have: > > $variables_order = "EGPCS", so $ENV[] array wasn't getting popualted at > all. The port only installs php.ini-dist and php.ini-recommended, which are the ones from the PHP source tree. If neither of these is copied to php.ini then php.ini-dist is hardcoded inside php itself, also not something the FreeBSD port alters. > Second, Apache FreeBSD RC scripts inherit the user environment from > sudo(8) unless you pass -H or -i flag/args > > E.x.:, > > % sudo -H -i -u root /usr/local/etc/rc.d/apache22 restart > > Compared to: > > $ su - > Password: > $ /usr/local/etc/rc.d/apache22 restart > > Result in completely different results in PHP's $_ENV[] As expected. However, stuff in /etc/profile applies to all Bourne type shells. > Additionally, the results of "$ su -" differ completely from the shell > environment that executes when rc(8) is first run at boot time. Correct. You can however clean the entire environment, by setting apache22limits_enable="YES" and apache22limits_args="-e -E -C daemon". If you need specific variables to be available and the rest to be gone, the standard rc script doesn't support it. You'd have to roll your own. > I may be better off using getenv() in PHP directly. For portability yes, since it doesn't rely on EGPCS, but otherwise they give the same results. -- Mel Problem with today's modular software: they start with the modules and never get to the software part.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812291205.26505.fbsd.questions>