ID: 50807
Updated by: [email protected]
Reported By: skasun at tucson dot com
-Status: Open
+Status: Feedback
Bug Type: Network related
Operating System: OS X Leopard Server
PHP Version: 5.3.1
New Comment:
PHP doesn't do anything magic here. We are simply calling your
system's getaddrinfo function. The code looks like this:
if ((n = getaddrinfo(host, NULL, &hints, &res))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"php_network_getaddresses: getaddrinfo failed: %s",
PHP_GAI_STRERROR(n));
}
getaddrinfo() returns 0 on success. And as you can see from the code,
the error is coming from your getaddrinfo() low-level call. That error
message corresponds to an EAI_AGAIN error from the call. On my system
the man page just says:
EAI_AGAIN
The name server returned a temporary failure indication.
Try again later.
So, I am not sure how to help you here. I see nothing wrong with the
code as evidenced by the fact that it works most of the time for you.
Can you check the logs of your dns server and see why you might be
getting temporary failures there?
Previous Comments:
------------------------------------------------------------------------
[2010-01-20 18:20:51] skasun at tucson dot com
Description:
------------
We keep sporadically getting this error:
Warning: file_get_contents() [function.file-get-contents]:
php_network_getaddresses: getaddrinfo failed: Temporary failure in name
resolution in [path to script] on line XX
It has nothing to do with DNS on the machine. I can have dns_get_record
return a valid response on the exact same page as that error. It's also
not consistent. getaddrinfo works 90% of the time, but randomly,
without any changes to the machine or the scripts, it will give the
above error.
Reproduce code:
---------------
$page=file_get_contents("http://google.com");
Expected result:
----------------
The contents of google.com gets put into $page
Actual result:
--------------
90% of the time, we get the expected result.. but then it will start
failing and it may take several page reloads for it to start magically
working again.
Warning: file_get_contents() [function.file-get-contents]:
php_network_getaddresses: getaddrinfo failed: Temporary failure in name
resolution in [path to script] on line XX
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50807&edit=1