tags:

views:

318

answers:

2

When accessing my site from a number of machines $_SERVER['REMOTE_ADDR'] always resolves to an empty string. What can be the cause of this?

Additional info: One of the machines is running the site on localhost. Shouldn't a machine on localhost always resolve to 127.0.0.1?

My set up is LAMP. One dev. machine that runs the site localhost and that has the problem is a Mac and runs XAMPP. I think our live staging environment is CentOS (shared host).

+2  A: 

I guess this results from a missing reverse delegation for the address. You should avoid reverse resolution unless absolutely necessary.

Not only is it expensive in terms of latency, but can also yield unexpected results as there is no requirement on what to resolve to - or to resolve at aall.

Jan Jungnickel
I think you're thinking of REMOTE_HOST. REMOTE_ADDR is the IP address.
Greg
A: 

Try looking at phpinfo() from those machines and see what they present.

Ólafur Waage
That will take some time. Not all machines are under my control.
Luke