From owner-freebsd-questions@FreeBSD.ORG Mon Dec 29 21:05:44 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AAC01065672 for ; Mon, 29 Dec 2008 21:05:44 +0000 (UTC) (envelope-from fbsd.questions@rachie.is-a-geek.net) Received: from mail.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 066FF8FC4F for ; Mon, 29 Dec 2008 21:05:42 +0000 (UTC) (envelope-from fbsd.questions@rachie.is-a-geek.net) Received: from localhost (mail.rachie.is-a-geek.net [192.168.2.101]) by mail.rachie.is-a-geek.net (Postfix) with ESMTP id 2F5D5AFBC02; Mon, 29 Dec 2008 12:05:41 -0900 (AKST) From: Mel To: freebsd-questions@freebsd.org, bseklecki@collaborativefusion.com Date: Mon, 29 Dec 2008 12:05:26 -0900 User-Agent: KMail/1.9.10 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> In-Reply-To: <1230581553.19488.7.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812291205.26505.fbsd.questions@rachie.is-a-geek.net> Cc: Bill Moran Subject: Re: Default list of exported variables in sh(1) - $HOSTNAME X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Dec 2008 21:05:44 -0000 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.