If you happen to be running *nix (which it sounds like you are) and want to
compile the Pwee extension into PHP you can have access to constants like
SERVER_HOSTNAME.

http://pwee.sourceforge.net

Lance

> -----Original Message-----
> From: Spongle [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 07, 2002 4:20 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Getting fully qualified host name
>
>
> I need to get the fully qualified host name of the local machine, like
> "server.somewhere.com". Sounds simple, right? Seems not.
>
> 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, and it doesn't seem to be lying about
> in my environment (not that I want to rely on that anyway).
>
> 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 platform-specifics like rummaging in
> /etc and parsing config files or doing something silly like a reverse
> DNS lookup...
>
> On some OS, this will give me the hostname:
> $hostname = `/bin/hostname`;
>
> However, it doesn't give me the domain, and it's highly platform
> specific (i.e. it won't work on Win).
>
> This seems like a pretty fundamental function that should be a
> built-in, but it doesn't seem to be possible to do this in a
> platform-independent way.
>
> Have I missed some php_fqdn() function?
>
> Any better 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

Reply via email to