PHP error: php_network_getaddresses: getaddrinfo failed: (while getting information from other site.)

后端 未结 11 1109
时光说笑
时光说笑 2020-12-01 10:18

Trying to get information from an external source, I\'m receiving the following error:

Warning: php_network_getaddresses: getaddrinfo

相关标签:
11条回答
  • 2020-12-01 10:58

    In the following httpd.conf file, configure the ServerName properly.

    /etc/httpd/conf/httpd.conf

    Like below:

    ServerName 127.0.0.1:80
    

    or

    ServerName sitename
    

    This resolved similar issue I was facing.

    0 讨论(0)
  • 2020-12-01 10:58

    Although I didn't use this exact function I got this same error.

    In my case I just had to remove the protocol.

    Instead of $uri = "http://api.hostip.info/?ip=$ip&position=true";

    Use $uri = "api.hostip.info/?ip=$ip&position=true";

    And it worked fine afterwards

    0 讨论(0)
  • 2020-12-01 10:59

    I faced a similar issue on Docker for Ubuntu. It's a DNS issue. You will have to add Google Public DNS Settings into your network. Instruction for adding those settings is OS dependant. In my case, I was using Ubuntu so I added via network manager. Visit this site for more info.

    0 讨论(0)
  • 2020-12-01 11:08

    It's because you can't resolve the host name Maybe DNS problems, host is unreachable...

    try to use IP address instead of host name... ping this host name... nslookup it...

    0 讨论(0)
  • 2020-12-01 11:11

    I would imagine that the caching DNS servers you're using aren't behaving properly (or the DNS server for the domain you're resolving isn't working properly). You can try to fix the former possibility.

    Do you have at least 2 name servers registered on your network adapter? You could always swap your computer over to use a different caching DNS server to rule this out. Try Google's:

    8.8.8.8
    8.8.4.4
    
    0 讨论(0)
提交回复
热议问题