Localhost IP address is not displaying correctly

Hi there

I am using XMAPP server for PHP development but in my case my localhost IP address 127.0.0.1 is not displaying in web browser.

This is my Script

    <?php $ip_address=$_SERVER['REMOTE_ADDR'];echo 'IP Address '.$ip_address;
      ?>

and I am getting address like this

IP Address ::1

What’s wrong with my code?

Thanks

That’s the IPV6 format, and is pretty common when dealing with localhost. I’m guessing that when you deploy the code, it’ll display the typical IPV4 format.

Nothing - that answer means it is working correctly.

So How can I get address in IPv4 format?

It’s based on how your server is set up. Since you’re only having the problem with localhost, don’t worry about it.

Ok Thanks

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.