Re: $_SERVER["REMOTE_ADDR"] returning ::1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18 Sep 2008, at 05:57, David Rocks wrote:
I am running a test PHP web app on my local machine that uses REMOTE_ADDR and most of the time ::1 is returned as the IP addr and sometimes it is 127.0.0.1 . I am on OS X 10.5.5 and using APACHE 2. PHPINFO always returns ::1 for REMOTE_ADDR. Is this a PHP or a APACHE 2 thing?

It's coming from Apache and is correct. ::1 is the same as 127.0.0.1 in IPv6. Which you get will depend on how you request the page and how your DNS/hosts file is set up. Request it with an IPv6 domain/IP and REMOTE_ADDR will also be IPv6.

You should be able to disable IPv6 in your system settings, but from a future-proof point of view you should be able to handle both.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux