Developing a plugin for WordPress locally I'm wanting to implement Akismet in form validation but I'm required an IP address with the submission and when I run:
function check_ip_address() {
if (isset($_SERVER['REMOTE_ADDR'])) :
$ip_address = $_SERVER['REMOTE_ADDR'];
else :
$ip_address = "undefined";
endif;
return $ip_address;
}
echo check_ip_address();
I get back a ::1
. When I researched to resolve this I didn't find a solid answer from:
When researching how to resolve ::1
I found Should a MAMP return ::1 as IP on localhost? that suggests a sudo
of:
sudo vi /etc/apache2/httpd.conf
So I go to MAMP/conf/apache/httpd.conf
and try to modify line 48 from Listen 8888
to Listen 127.0.0.1
and I get an error and Apache will not restart. How can I modify my MAMP IP so I can get a proper IP from $_SERVER['HTTP_USER_AGENT']
?