0

I am using parallels and had my site working fine with subdomains. Our server had to be rebooted today and once rebooted, I had to restart apache via the command line. I have some php code that grabs some forum data from our forums via rss (forums.oursite.com) as well as our recent blog entries but the code now throws the error of:

file_get_contents(http://forums.oursite.com/discussions/feed.rss):php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

I can get to the subdomain just fine and when I ssh in, can hit it using 'host'. I've read other posts which mention simply restarting Apache but I have done that several times to no avail.

How can I get this fixed?

BenMorel
  • 34,448
  • 50
  • 182
  • 322

2 Answers2

0

I once had similar error messages. We had already checked that we had connectivity, that host name resolution worked for root with lynx/nc/host, and it even worked for many processes - but not processes running as non-root.

In the end we found that the file /etc/resolv.conf had wrong permissions - it was not readable for anyone but root.

Solution?

chmod 644 /etc/resolv.conf

More info at this blogpost.

hennings
  • 121
  • 3
0

Basically, the nameservers entries in /etc/resolv.conf are overwritten by the NetworkManager with the default DNS nameservers that are in the eth profile associated to the ethernet IP config. Restarting apache service might not help in this scenario

The solution mentioned by @m-canvar in SO thread PHP error: php_network_getaddresses: getaddrinfo failed: (while getting information from other site.) could help.

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,

set NM_CONTROLLED=no

in the eth profile associated to the IPv4/IPv6 profile or disable NetworkManager service

chkconfig NetworkManager off
service NetworkManager stop

It took several hours of my efforts to find a proper solution to this problem. Hope my detailed post Solved: DNS Servers in /etc/resolv.conf - get_headers(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution could help some of you if you are struggling with this issue.