Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP $_SERVER['REMOTE_HOST'] returns ::1 [duplicate]

Tags:

php

ip-address

Possible Duplicate:
should $ip=$_SERVER['REMOTE_ADDR']; return ::1 on a mamp localhost?

I am trying to get the IP address of the website visitor in PHP. I'm expecting $_SERVER['REMOTE_HOST'] to return something like 127.0.0.1, but it's returning ::1.

like image 676
Peter Avatar asked Dec 17 '22 02:12

Peter


1 Answers

::1 is the IPv6 equivalent of 127.0.0.1 - see http://www.juniper.net/techpubs/software/erx/erx50x/swconfig-routing-vol1/html/ipv6-config5.html The long form of that is
0:0:0:0:0:0:0:1 - but the :: stands in for the run of 0's.

like image 185
Alister Bulman Avatar answered Jan 04 '23 07:01

Alister Bulman