0

I want to get value 127.0.0.1 when do $_SERVER['REMOTE_ADDR']. But instead getting 127.0.0.1. I get value ::1. Anyone can help me how to get that value? Used it for log activity.

Rudy Hartanto
  • 17
  • 1
  • 9

1 Answers1

3

::1 is an IPv6 address and an abbreviation for 0:0:0:0:0:0:0:1 that is the loopback address to the local machine. So ::1 is the same as 127.0.0.1 only via IPv6 instead of IPv4.

If you really just want IPv4, try to disable IPv6 connections in your apache configuration:

Listen 0.0.0.0:80
Listen 192.170.2.1:80

You can find detailed solution here

Community
  • 1
  • 1
chandresh_cool
  • 11,753
  • 3
  • 30
  • 45