hi!

does anyone of you know why the variable
$REMOTE_ADDR has the value '127.0.0.1'?
i've a file called test.php which i put on
my hosting-server. it calls phpinfo - here
i can see that REMOTE_ADDR is 127.0.0.1 ...

any ideas?

thanks in advance

bs

    The default IP of your localhost (i.e. your machine server will be 127.0.0.1). It has always been that.

    You can define an IP in your networking and use that but 127.0.0.1 will still work.

    Your connecting to your local site on your own machine which means your IP will be the same as the server.

    I doubt VERY much that YOUR ip will be 127.0.0.1 when connecting to a machine over the web, it's impossible.

      I doubt VERY much that YOUR ip will be
      127.0.0.1 when connecting to a machine over
      the web, it's impossible.

      i KNOW that. but its obviously that the
      value of the variable $REMOTE_ADDR is always
      127.0.0.1 ... but i found that the variable
      $HTTP_X_FORWARDED_FOR contains the ip im
      searching for.

      thx for your anwser

      regards

      bs

        This is just a guess, but it sounds like your Web host might have a setup in which something like Apache's mod_proxy is being used to direct traffic to a secondary Web server, where your code actually runs.

        The current Linux-Mandrake distribution uses this technique for mod_perl and embperl support. Since Perl is rather large (relative to PHP) and embedded Perl isn't the sort of thing most sites use on every page, running that code on a separate dedicated HTTPD server (even on the same machine!) saves some overhead.

          If you actually tell us your setup (linux/windows/apache/iis etc) then we'd be able to help you. 😛

          Have you uploaded that page to a PHP-enabled server (or just another machine) and accessed it remotely? If not, then you can just assume that it is reading your local IP, and not your NICs.

            Write a Reply...