remote_addr not returning IPv4 address

前端 未结 4 549
说谎
说谎 2020-12-30 08:56

I am using xampp on localhost and when I use $_SERVER[\"REMOTE_ADDR\"] it returns ::1 (also does this in phpinfo()). Why does it do th

4条回答
  •  一向
    一向 (楼主)
    2020-12-30 09:56

    You have to disable IPv6 support in your OS for apache to stop showing these IPv6 format addresses, when you want the IPv4 format. I disabled IPv6 support and its working as expected now.

    The following instructions to disable IPv6 could be helpful, http://support.microsoft.com/kb/929852

    Just so you know i followed the steps described in the above link and i'm using Windows 7 not Vista though i doubt there could be any or many differences.

    I recently ran into this issue, though i don't ever remember enabling ipv6 support on my system, could be done by Microsoft in one of their updates (maybe).

提交回复
热议问题