stack
stack

Reputation: 10228

Why $_SERVER['SERVER_ADDR'] doesn't work correctly?

I already use xampp 3.2.1 version and $_SERVER['SERVER_ADDR'] was fine. It returned some thing like this 172.0.0.1. But now I have updated my Xampp to 5.6.3 version and now $_SERVER['SERVER_ADDR'] doesn't work as well, it returns ::1.

What's the problem? And how can get the client IP now?

Upvotes: 2

Views: 1126

Answers (1)

David
David

Reputation: 3422

::1 is just the IPv6 loopback address of the localhost compared to the IPv4 address 127.0.0.1, so it is basically the same host, just a different protocol.

Upvotes: 2

Related Questions