remote_addr not returning IPv4 address

前端 未结 4 542
说谎
说谎 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:41

    Your apache is listening for IPv6 connections by default (::1 being local loopback). If you really just want IPv4, try to disable disable IPv6 connections in your apache configuration:

    If you want Apache to handle IPv4 connections only, regardless of what your platform and APR will support, specify an IPv4 address on all Listen directives, as in the following examples:

    Listen 0.0.0.0:80
    Listen 192.170.2.1:80
    
    • http://httpd.apache.org/docs/2.0/bind.html

提交回复
热议问题