Re: REMOTE_ADDR
| From: | Rasmus Lerdorf | Date: | Mon, 14 Mar 2005 18:02:22 +0000 |
| Subject: | Re: REMOTE_ADDR | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-210676@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
getenv() is actually the more portable way to do this since there is no guarantee that $_SERVER is enabled.I am running PHP 5 on a Apache platform (Mac) and I have just noticed that the log I keep of ip's entering my site, is showing the internal server ip instead of the external visitor ip. I am using getenv("REMOTE_ADDR") and is has been working before.Try $_SERVER['REMOTE_ADDR'] instead of getenv()
Not sure it will be different, but it's what I use...It won't be. getenv() first checks the server environment and if it doesn't find the value there it checks the underlying real environment. If getenv() doesn't find it, $_SERVER definitely won't either. This is a var set by the web server, so if it is missing, look at the web server for the problem. -Rasmus