Shouldn't the value match the IP of the computer that's requesting the script regardless of the fact that it's the same computer that's hosting the script?
Shouldn't the value match the IP of the computer that's requesting the script regardless of the fact that it's the same computer that's hosting the script?
Because when you run PHP locally every request you make will come from your machine, which happens to have a remote (or in this case, local) address of... wait for it.... 127.0.0.1 (== localhost).
Elaboration: Let's assume for a second you have no internet connection, nothing at all, no WiFi, no cable. The local connection would still work. Why? because it would be stupid to require internet connection for local affairs. Instead, the connection comes from the server itself which means, you will see
localhost
or127.0.0.1
as the remote address, because that's the remote address of the server, relatively to the server.The reason for this is that you're talking to 127.0.0.1.
When talking to a network device (local machine or otherwise), packets has to have a source address, and an address is picked that will be available in the network you're communicating over.
So the source address used depends on the target address being communicated with.
Since the server is reporting that you're coming from 127.0.0.1, you will have to be talking to 127.0.0.1, because that's the only target address where that source address would've been picked.
If you had talked to your machine using its IPv6 local address (
::1
), then you would've seen::1
reported as the source address as well.However, in order to see the
95.87...
address, you need to be talking to that address as well.You can try that by simply replacing the hostname or localhost or whatever you wrote in the URL with
95.87...
for the hostname part, and it should report that you're also coming from that address.My guess is that you're doing
http://machinename
, which is resolving to127.0.0.1
, and thus the127.0.0.1
address was picked as the source address as well.It is a local connection.
The connection is being made locally. You local IP address for your localhost is 127.0.0.1.
No connections are being made through any other network other than your localhost.
because localhost === 127.0.0.1