php53 ipv6 and file_get_contents getaddrinfo failed

Jim Hu at
Wed Mar 4 07:48:43 PST 2015

New to the listserv and sorry if this is an old issue that I couldn't find an answer to via Google.

I've been running an older OSX 10.6 (Snow Leopard) XServe server for some time. It's an older Mac that can't be updated further. I have MacPorts running on it, but until recently I was using the MacPorts PHP53 with Apple's built-in apache2 by  including 

	LoadModule php5_module        /opt/local/apache2/modules/

in /etc/apache2/httpd.conf

Recently my campus security people wanted me to update the apache version being run on this server, so I inactivated the apple apache2 and restarted using the MacPorts version. Suddenly I started getting this error in my apache error logs: 

	file_get_contents(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in...

Googling this, there were a number of suggestions that this is an ipV6 problem, and indeed, if I inactivate ipv6 using ip6 -x and then restart apache (using stop and start) the functionality that uses file_get_contents starts working again. But once or twice per day, something breaks it again and I have to stop and start apache2 again.  I don't understand why this would be an apache issue, but I think I've seen this for over a year because the reason I was running Apple's built in apache up until now, despite using MacPorts PHP is that certain functionalities on my site stopped working when I previously tried to switch to MacPorts apache2. I'm not even sure if ipv6 is the real problem, or whether the apache stop and start was what was providing the fix.

Since this doesn't seem to be a problem for others, I suspect that there is a configuration problem on my server of some kind. But I can't figure out what it is. Any suggestions would be welcome.


Jim Hu

More information about the macports-users mailing list