#42094 [Bgs]: getenv("REMOTE_ADDR") returns no IP address
| From: | fushimi at rep dot fielding dot nec dot co dot jp | Date: | Fri, 27 Jul 2007 04:59:53 +0000 |
| Subject: | #42094 [Bgs]: getenv("REMOTE_ADDR") returns no IP address | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-115492@lists.php.net to get a copy of this message | ||
ID: 42094
User updated by: fushimi at rep dot fielding dot nec dot co dot jp
Reported By: fushimi at rep dot fielding dot nec dot co dot jp
Status: Bogus
Bug Type: Apache2 related
Operating System: Windows 2000
PHP Version: 5.2.3
New Comment:
Thank you again for your help.
Could you give me any idea about how can I enable this option in
Apache2?
Previous Comments:
------------------------------------------------------------------------
[2007-07-26 09:50:13] jani@php.net
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-26 00:48:12] 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
========================
_SERVER["SERVER_ADDR"] 192.168.1.3
_SERVER["SERVER_PORT"] 80
_SERVER["REMOTE_ADDR"] 0.0.0.0
_SERVER["REMOTE_PORT"] 0
PHP5.1.2 and Apache2.0.59
=========================
_SERVER["SERVER_ADDR"] 192.168.1.2
_SERVER["SERVER_PORT"] 80
_SERVER["REMOTE_ADDR"] 192.168.1.1
_SERVER["REMOTE_PORT"] 2476
------------------------------------------------------------------------
[2007-07-25 11:58:27] jani@php.net
Does it show up in $_SERVER['REMOTE_ADDR'] ??
------------------------------------------------------------------------
[2007-07-25 07:53:25] fushimi at rep dot fielding dot nec dot co dot jp
Description:
------------
I am evaluating the newest PHP 5.2.3, in relation with my current PHP
5.1.2.
So, when I tried to get the remote IP using getenv(REMOTE_ADDR), I
obtained the following results:
PHP 5.2.3 => return 0.0.0.0
PHP 5.1.2 => return 192.168.1.1
PHP in ISAPI mode.
Reproduce code:
---------------
$ip = getenv("REMOTE_ADDR");
echo "IP Address ....: ".$ip;
Expected result:
----------------
IP Address ....: 192.168.1.1
Actual result:
--------------
IP Address ....: 0.0.0.0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42094&edit=1