RE: [PHP] why is SERVER_ADDR empty from command line script?

From: Date: Mon, 12 May 2003 00:37:04 +0000
Subject: RE: [PHP] why is SERVER_ADDR empty from command line script?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147241@lists.php.net to get a copy of this message
> -----Original Message----- > From: Daevid Vincent [mailto:daevid@daevid.com] > Sent: Sunday, May 11, 2003 7:43 PM > To: 'PHP general mailing list' > Subject: RE: [PHP] why is SERVER_ADDR empty from command line script? > > > Soooo... Then is there a PHP variable that will tell my my IP address? > Seems silly that PHP doesn't know it's own IP address? 1) A mchine running PHP may have no IP address - not all machines are on a network. 2) SERVER_ADDR is set by a server, not PHP 3) There may be more than one IP number for a machine (mine have between 2 and 12 assigned - which one should be returned by PHP? 4) There may be more than one IP number for a hostname - which one should be returned by PHP? 5) If you know your server's name then gethostbyname() will return an IP number associated with the name. If there's more than one IP number assigned then gethostbynamel() will return all of them in an array. If things seem straightforward and obvious - then they probably aren't ;^)

« previous php.general (#147241) next »