[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: php _SERVER["REMOTE_ADDR"] is fixed ip address



On 11/6/05, 高勇KevinGao <delubi@gmail.com> wrote:
> I use debian sarge version
> now I found a problem in php
> when using
>  getenv("REMOTE_ADDR") or
> _SERVER["REMOTE_ADDR"]
> return a fixed ip address,not my real internet ip address
> but the same code is ok in an freebsd server
> anyone can tell me why?

That depends on how you are accessing the server.

REMOTE_ADDR returns the value of the IP address of the machine doing
the request to the web server.  It is not the address of the
webserver.

I'm assuming by 'fixed ip address' you are refering to a private,
internal ip such as 192.168.0.15 or 10.1.3.125 (or something similar)

If you want the IP of the server, use SERVER_ADDR -- this will report
the IP address that the server accepted the request on.

If both machines are on a private network they will always report
private ip's and not you "real" internet address.

--
~ Darryl  ~ smartssa@gmail.com
http://smartssa.com / http://darrylclarke.com

Reply to: