[PHP] Re: Getting local domain name in CLI

2002-08-29 Thread Philip Hallstrom

What about...

$hostname = `/bin/hostname`;

or something along those lines...

On Thu, 29 Aug 2002, Geranium wrote:

 I need to get the domain name of the local machine.
 I'm running a CLI script in PHP 4.3-cvs (on OpenBSD) so I have no HTTP
 or other global vars to look at. The posix_uname command doesn't
 include the domain on non-GNU OSs. I can get the hostname, but not the
 domain. Can I get it through some other PHP command? I'd really prefer
 not to resort to rummaging in /etc and parsing files or doing something
 silly like a DNS lookup...

 Any ideas?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Getting local domain name in CLI

2002-08-29 Thread Geranium

In article [EMAIL PROTECTED],
Philip Hallstrom [EMAIL PROTECTED] wrote:

 What about...
 
 $hostname = `/bin/hostname`;
 
 or something along those lines...

Well that's rather the kind of thing I was wanting to avoid - it's much
akin to rummaging in /etc.

the hostname command gives me my hostname ONLY (like www), much as
the posix_uname function does, but on my system (OpenBSD 3.1) the
corresponding domainname utility returns nothing (as I'm not using YP),
so I still can't seem to find this out from PHP. This seems very silly!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php