1

I'm using XAMPP platform( php, apache, mysql ). I connecting to apache via localhost. I want to know user ip using this php code:

echo $_SERVER['REMOTE_ADDR'];

And I get on my page in my browser.

::1
Oldook
  • 107
  • 5

2 Answers2

3

::1 is the localhost in IPv6. Looks ok

hek2mgl
  • 152,036
  • 28
  • 249
  • 266
0

As i commented it seems ipv6 , actually showing loopback addr ,

any way if you want ipv4 change it in server configuration , i think surplus tuts where available

test yourself with this singler

echo "Server Configured to use  ". (strstr($_SERVER("REMOTE_ADDR"), ".")) ? "IPv4" : "IPv6" ;

or if just want to test its ipv(4/6)

 if (((strstr($_SERVER("REMOTE_ADDR"), ".")) ? 4 : 6 )==4)
  {
   //ipv4
  }

  else

 {
  //ipv6
 }
internals-in
  • 4,798
  • 2
  • 21
  • 38