Addressing a PHP Name Resolution Glitch

My PHP error logs have been filling up with an ominous error message:

PHP Warning: main(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure)

I don't know about the low-level cause for the problem, but I've figured out why it's happening so often on my server. I had the bad habit of using URLs in include statements for local pages, like this:

include 'http://ekzemplo.com/menu.htm';

This was causing some pages to require three or more extra domain name lookups, just to pull files from my own server! I'm switching these statements to local file references:

include '/www/ekzemplo/menu.htm';

Server performance has improved noticeably, though I still have no idea what any of this has to do with IPV6.

Comments

I (almost) hate to point this out, but that's still not technically a "relative" file reference, it's an absolute path, since it begins with "/" rather than a "./" or a null prefix.

But yeah, that's a rather good thing not to be doing.

Thanks -- I've corrected it.

The problem is that PHP has some issue (i've not discovered a solution yet) with name resolution. This is your real problem. If you put the URL on your hosts file, even if you use http://ekzemplo.com at the begining of your include it will works fine. Try it!

Add a Comment

All comments are moderated before publication. These HTML tags are permitted: <p>, <b>, <i>, <a>, and <blockquote>. This site is protected by reCAPTCHA (for which the Google Privacy Policy and Terms of Service apply).