php53 ipv6 and file_get_contents getaddrinfo failed

Jeremy Lavergne jeremy at lavergne.gotdns.org
Wed Mar 4 17:26:55 PST 2015


On March 4, 2015 8:22:01 PM EST, Ryan Schmidt <ryandesign at macports.org> wrote:
>
>On Mar 4, 2015, at 9:48 AM, Jim Hu wrote:
>
>> 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/mod_php53.so
>> 
>> 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.
>
>I haven't run into this, but I don't do much PHP programming anymore.
>All I can suggest is that, since PHP 5.3 is at end of life, you try a
>newer version of PHP. We have php54, php55 and php56 in MacPorts as
>well. Of course you may need to change your project's code to be
>compatible with these versions. There are guides on the PHP web site
>for how to do that, links to which are printed by running "port notes
>php53". 
>
>If you suspect this is related to using Apache, you could also consider
>trying a different web server, such as nginx which I understand is very
>popular. Under such a web server, you would no longer be using the PHP
>Apache SAPI (in the php*-apache2handler ports), but instead the PHP
>FastCGI Process Manager SAPI (in the php*-fpm ports).
>
>_______________________________________________
>macports-users mailing list
>macports-users at lists.macosforge.org
>https://lists.macosforge.org/mailman/listinfo/macports-users

You should use php fpm regardless of the web server.


More information about the macports-users mailing list