Today I was working on Amuzi and when I did an HTTP request on my local deploy
there was an error. The odd thing is that the error happened in a place that used
to be very solid. Digging down, I found that PHP was having trouble with
file_get_contents() opening a URL. It was generating the following warning:
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname
I’ve checked my DNS and everything was OK. Tried running the script on the command line, and it worked. There I knew it could only be something nasty related to Apache.
Then I found a comment from 2003 on a PHP bug report.
The comment from fcartegnie explained that Apache gets the DNS entries from
/etc/hosts when it is starting. So, if you have started your Apache before
your network is set up, Apache could end up with no working DNS to request.
I restarted my Apache (now that my network is working) and everything went back to normal.