Aside from the obvious (localhost, 127.0.0.1) does PHP (command line interface!) have a mechanism for discovering the IP of the computer the script is running on?
try this it should return the ip address of the server
$host= gethostname(); $ip = gethostbyname($host);