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?
If you are working with PHP < 5.3, this may help (on *NIX based systems atleast):
mscharley@S04:~$ cat test.php
#!/usr/bin/env php
string(13) "72.67.113.141"
[1]=>
string(27) "fe80::21c:c0ff:fe4a:d09d/64"
[2]=>
string(13) "72.67.113.140"
[3]=>
string(9) "127.0.0.1"
[4]=>
string(7) "::1/128"
}
mscharley@S04:~$
Or, if you don't anticipate doing it often, then perhaps this would work (just don't abuse it):
$ip = file_get_contents('http://whatismyip.org/');