why is SERVER_ADDR empty from command line script?
| From: | Daevid Vincent | Date: | Sun, 11 May 2003 23:15:20 +0000 |
| Subject: | why is SERVER_ADDR empty from command line script? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-147233@lists.php.net to get a copy of this message | ||
How come I can't get my SERVER_ADDR when running a script via the
command line (yet it works if I run it via web page)? I also tried this
suggestion, "print_r($GLOBALS);" which dumps out all sorts of
interesting information, but NONE of which are my server's IP!!!?
-------------------------
#!/usr/bin/php -q
<?php
echo "_SERVER['SERVER_ADDR'] =
".$_SERVER['SERVER_ADDR']."\n";
echo "_SERVER['REMOTE_ADDR'] =
".$_SERVER['REMOTE_ADDR']."\n";
echo "SERVER_ADDR = ".$SERVER_ADDR."\n";
echo "REMOTE_ADDR = ".$REMOTE_ADDR."\n";
?>
-------------------------
And the output...
_SERVER['SERVER_ADDR'] =
_SERVER['REMOTE_ADDR'] =
SERVER_ADDR =
REMOTE_ADDR =