A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearPHP $_SERVER['REMOTE_ADDR'] sometimes resolves to empty string - page 1
User InfoPosts
PHP $_SERVER['REMOTE_ADDR'] sometimes resolves to empty string#1
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).

posted date: 2009-04-17 01:53:00


Re: PHP $_SERVER['REMOTE_ADDR'] sometimes resolves to empty string#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-17 01:53:01


Re: PHP $_SERVER['REMOTE_ADDR'] sometimes resolves to empty string#3
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.

posted date: 2009-04-17 01:58:00


Re: PHP $_SERVER['REMOTE_ADDR'] sometimes resolves to empty string#4
Try looking at phpinfo() from those machines and see what they present.

posted date: 2009-04-17 02:07:00


Re: PHP $_SERVER['REMOTE_ADDR'] sometimes resolves to empty string#5
I think you're thinking of REMOTE_HOST. REMOTE_ADDR is the IP address.

posted date: 2009-04-17 02:10:00


Re: PHP $_SERVER['REMOTE_ADDR'] sometimes resolves to empty string#6
What web server software, and what version of PHP?

posted date: 2009-04-17 02:18:00


Re: PHP $_SERVER['REMOTE_ADDR'] sometimes resolves to empty string#7
That will take some time. Not all machines are under my control.

posted date: 2009-04-17 02:22:00


Re: PHP $_SERVER['REMOTE_ADDR'] sometimes resolves to empty string#8
Added additional info.

posted date: 2009-04-17 02:24:00


Re: PHP $_SERVER['REMOTE_ADDR'] sometimes resolves to empty string#9
Are you doing a gethostbyaddr() lookup on REMOTE_ADDR?

posted date: 2009-04-17 09:34:00


Re: PHP $_SERVER['REMOTE_ADDR'] sometimes resolves to empty string#10
I just ran into this problem, and it turns out that the PHP code was setting it to (( explicitly before running my code. This was because the IPv6 remote addr didn(t match its IPv4 only regex.Leaving this here in case someone else has the same problem, it was a too simple reason for me to spot it.The module in question was simplemachinesforum.

posted date: 2013-03-28 00:44:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.