|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42094 getenv("REMOTE_ADDR") returns no IP address
Submitted: 2007-07-25 07:53 UTC Modified: 2007-07-27 04:59 UTC
From: fushimi at rep dot fielding dot nec dot co dot jp Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 5.2.3 OS: Windows 2000
Private report: No CVE-ID: None
 [2007-07-25 07:53 UTC] fushimi at rep dot fielding dot nec dot co dot jp


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-25 11:58 UTC]
Does it show up in $_SERVER['REMOTE_ADDR'] ??
 [2007-07-26 00:48 UTC] fushimi at rep dot fielding dot nec dot co dot jp
Thank you, to reply me so quickly.

Yes, $_SERVER['REMOTE_ADDR'] return the right IP address.

One more thing that I forgot to mention, my Http server is Apache version 2.2.4.

To help you, below is the results of PHP variable using phpinfo():
PHP5.2.3 and Apache2.2.4

PHP5.1.2 and Apache2.0.59
 [2007-07-26 09:50 UTC]
It's apache that isn't setting it. PHP only sets the variables to whatever the server says they are. No bug in PHP.
 [2007-07-27 04:59 UTC] fushimi at rep dot fielding dot nec dot co dot jp
Thank you again for your help.

Could you give me any idea about how can I enable this option in Apache2?
 [2012-03-21 15:19 UTC] aladdin18 at hotmail dot com
Hi every one my name is AlAa

My problem with $_SERVER['remote_addr']

I'm not sure if I'm having a problem with the installation of PHP on the server or if there's something that I'm not doing right in the code, but I am trying to capture the IP address of anyone that is trying to log into a secure part of a site. Regardless of my IP address, when I do:


echo $_SERVER['remote_addr'];

It returns ''. This is the first time I've written code that is being used on a Windows Server, so I don't know if that has anything to do with it.

I've run phpinfo(), and in the PHP Variables section, it shows "_SERVER["REMOTE_ADDR"]" : Does this mean that the php.ini file is setup wrong, or am I missing something?

i am running my own server on windows 7 iis7.5 with php as fastcgi and i am behind a router with a dynamic ip not static and i am using that give me a link to my router and i am opening 80 port in my router forwarding it to my id address and i have tested a php file that contains 
tested it using tor network that give me ip out of my network to test that file always give me the same result i am trying to get IP address of the visitor and i asked someone of my friends to use this form it sends the same ip

i hope someone tells me what i am doing wrong and the solution for this problem

Thanks in advance
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC