Same question, and found a valid solution, tested, works well. I wanted to have the ip addy – of 127.0.0.1 as well instead of having to accept the the ::1 and debate the whole IPv4/6 issues. So, i trolled for a few moments and fell onto a 2008 comment made by @Brad – here:
http://board.issociate.de/thread/489575/SERVERquotREMOTEADDRquot-returning-1.html
Summarizing – (on Mac OS – Mountain Lion in particular)
sudo vi /etc/apache2/httpd.conf
Find where your apache is ‘listen’-ing to the ips/ports, etc…
Typically this will be a line looking like this
Listen 80
Make it look like this:
Listen 127.0.0.1:80
Resave it.
Restart Apache.
Voila!
Now $_SERVER[REMOTE_ADDR]
will look like this 127.0.0.1
.
Hope it helps someone.