From owner-freebsd-questions@FreeBSD.ORG Sat Dec 27 19:28:12 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 769AF106564A for ; Sat, 27 Dec 2008 19:28:12 +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 478298FC16 for ; Sat, 27 Dec 2008 19:28:12 +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 988DBAFBC02; Sat, 27 Dec 2008 10:28:11 -0900 (AKST) From: Mel To: freebsd-questions@freebsd.org, bseklecki@collaborativefusion.com Date: Sat, 27 Dec 2008 10:28:11 -0900 User-Agent: KMail/1.9.10 References: <1230146554.4673.265.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> In-Reply-To: <1230146554.4673.265.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: <200812271028.11339.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: Sat, 27 Dec 2008 19:28:12 -0000 On Wednesday 24 December 2008 10:22:34 Brian A. Seklecki wrote: > All: > > I've got a fun problem ... > > I'm having trouble tracking down where the default list of exported > variables is set for sh(1). > > I've got a piece of PHP code that runs on GNU/Linux but not FreeBSD > because (I think) $HOSTNAME is exported by default. > > The PHP CLI calls $_ENV["HOSTNAME"], which under GNU/Linux returns: > > $ php -r 'print gethostbyaddr(gethostbyname($_ENV["HOSTNAME"]))' > soundwave.ws....collaborativefusion.com > > In HTTP/CGI mode, I can call $_SERVER[]. But $_ENV[] should work in both > CLI and HTTP mode. > > However, because Apache is spawned from sh(1) from rc(8) and in FreeBSD > 6.x, $HOSTNAME is not exported by default, which is what $_ENV[] uses > (getenv()): > > $ uname -a > FreeBSD bdb00 6.3-RELEASE-p2 > $ export > SSH_CLIENT > USER > MAIL > HOME > SSH_TTY > PAGER > ENV > LOGNAME > BLOCKSIZE > TERM > PATH > SHELL > 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 in /usr/share/skel on FreeBSD does not set them. Neither does /etc/login.conf. I would set it in /etc/profile. -- Mel Problem with today's modular software: they start with the modules and never get to the software part.