$hostname = exec('hostname');   // this runs /bin/hostname on my machine

A CLI script, of course, wouldn't have any concept of virtual hosts, but perhaps the hostname supplied by the OS would suffice.

Richard




On Aug 21, 2008, at 10:00 PM, Wade Preston Shearer wrote:

I have a CLI PHP script that is run by cron that is missing nearly every _SERVER and _ENV variable. I understand that this is generally the case, but there is one variable that I really, really need. I need to know the host name of the server that the script is running on. Every possible value that I could use to deduce that from…

$_SERVER['HTTP_HOST']
$_SERVER['SERVER_NAME']
$_SERVER['HOSTNAME']
$_ENV['HOSTNAME']


…are empty. Any ideas? Any way that I can get one (or more) of those values to be populated? Any other way to determine what server I'm on?
_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net



_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to