What's My IP?

Whats up with my local ip address?

  • I'm trying to create a PHP script for my homework. I need the script to log ip addresses for security reasons. For some reason, when I run the following code: echo $_SERVER['REMOTE_ADDR']; The result is : ::1 I thought a localhost ip address was always like 127.0.0.1 ? Does anyone know what is happening ? This is really bugging me and I can't seem to find a solution to the problem. Even google doesn't find anything related... I should mention that I'm running an XAMPP installation on a windows 7 64bit machine. Thanks in advance.

  • Answer:

    On Windows 7 localhost resolves to ::1 which is the ipv6 representation of 127.0.0.1 Open C:\Windows\System32\drivers\etc\hosts Remove the following line, if present: ::1 localhost Add the following line, if not present: 127.0.0.1 localhost if you also need mysql connection, it will help you to speed up the connection.

Joel Murphy at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

::1 is an http://en.wikipedia.org/wiki/IPv6 http://en.wikipedia.org/wiki/Loopback/localhost address, as 127.0.0.1 is for http://en.wikipedia.org/wiki/IPv4. Your system can have an IPv4 and and IPv6 address if it is properly configured. The fact that you're seeing this indicates that your sever is supporting IPv6. It may also be supporting IPv4. When a server has multiple addresses, magic globals like REMOTE_ADDR will only show one of them (typically the one which will be used by default).

Jeremy Banks

::1 is the localhost address under http://en.wikipedia.org/wiki/IPv6 127.0.0.1 is the localhost address under http://en.wikipedia.org/wiki/IPv4.

J.Kommer

This is your IPv6 address, see http://en.wikipedia.org/wiki/IPv6

topek

::1 is the IPv6 version of 127.0.0.1. If you google IPv6, you should get a lot further. Good luck!

toon81

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.