Yasen Ivanov
Yasen Ivanov

Reputation: 1023

Why $_SERVER['REMOTE_ADDR'] returns 127.0.0.1 instead of public IP?

It is very confusing for me why on localhost my IP address is 127.0.0.1 ? That has to be the server IP, not the client IP? When I run my website I run it as a user, right?

Upvotes: 1

Views: 1593

Answers (1)

Adeel Raza
Adeel Raza

Reputation: 601

The PHP manual says

"REMOTE_ADDR" => The IP address from which the user is viewing the current page.

You are currently viewing the page from localhost i.e 127.0.0.1, simple.

Upvotes: 1

Related Questions