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. _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"