NYCPHP Meetup

NYPHP.org

[nycphp-talk] Getting IP address from $_SERVER

Khalid Hanif phplists at jellyandcustard.com
Tue Oct 9 13:08:33 EDT 2007


Hi Cliff,

$_SERVER['SERVER_ADDR'] gives me the correct IP on a development  
server. Your mileage may vary for a local machine running apache  
locally...

Regards,
Khalid

On 9 Oct 2007, at 17:53, Cliff Hirsch wrote:

> I am trying to get the server address of my development server, but  
> $_SERVER[‘remote_addr’] and $_SERVER[‘server_addr’] keep giving me  
> the localhost addr (127.0.0.1). Kinda makes it hard to create a URL  
> for redirects.
>
> The IP address should be 192.168.168.###, based on the current DHCP  
> setting.
>
> How do I get the IP address of the machine?
>
> Cliff
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20071009/633368f9/attachment.html>


More information about the talk mailing list