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

后端 未结 11 1132
时光说笑
时光说笑 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:53

    Although this is a old thread, I have come across the same error recently while running nslookup in CentOS 7 and google search led me to some of the discussions in SO including this one. However, adding the nameservers entries to /etc/resolv.conf alone did not help as the nameserver values in resolv.conf were overwritten by the NetworkManager with the default DNS nameservers that are in the eth profile associated to the ethernet IP config.

    As mentioned by @m-canvar, set the following entries in /etc/resolv.conf

    search yourdomain.com
    nameserver 8.8.8.8
    nameserver 4.2.2.1
    nameserver 8.8.4.4
    

    To prevent overwriting these entries by NetworkManager, there are two two approaches:

    Option 1: Either set NM_CONTROLLED=no in the eth profile associated to the IPv4/IPv6 profile.

    Option 2: Disable NetworkManager service from running.

    chkconfig NetworkManager off
    service NetworkManager stop
    

    More details can be referred in my post about this error and solution.

提交回复
热议问题