views:

128

answers:

2

I am using xampp on localhost and when I use _SERVER["REMOTE_ADDR"] it returns ::1 (also does this in phpinfo()). Why does it do this? I want it to return a normal ip address like 127.0.0.1. My operating system is windows vista.

+4  A: 

::1 is an IPv6 address and an abbreviation for 0:0:0:0:0:0:0:1 that is the loopback address to the local machine. So ::1 is the same as 127.0.0.1 only via IPv6 instead of IPv4.

Gumbo
+1  A: 

Your apache is listening for IPv6 connections by default (::1 being local loopback). If you really just want IPv4, try to disable disable IPv6 connections in your apache configuration:

If you want Apache to handle IPv4 connections only, regardless of what your platform and APR will support, specify an IPv4 address on all Listen directives, as in the following examples:

Listen 0.0.0.0:80
Listen 192.170.2.1:80
The MYYN