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.
Asked
Active
Viewed 2,114 times
1 Answers
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
-
hmm i see. then i cant get value 127.0.0.1? i want to save it in database, and then show it in the log activity page. Show in log activity page using 127.0.0.1 is better than show ::1 – Rudy Hartanto Apr 25 '13 at 05:33
-
or maybe i must get IPv$ instead of IPv6? – Rudy Hartanto Apr 25 '13 at 05:34
-
You can just check the link which I have added with the answer. You just need to change your .conf settings and restart the server. – chandresh_cool Apr 25 '13 at 05:34
-
go to terminal and type sudo vi /etc/apache2/httpd.conf and then change the configuration – chandresh_cool Apr 25 '13 at 05:43
-
iam looking httpd.conf, and then open with notepad++. Terminal = command prompt u means? because when iam type that in cmd didnt work – Rudy Hartanto Apr 25 '13 at 05:45
-
but anyway its solved, now just curious how to edit using sudo vi. – Rudy Hartanto Apr 25 '13 at 05:46
-
Yes you should go to command prompt and then open the httpd.conf using the command i just told – chandresh_cool Apr 25 '13 at 05:47