Bug #11058 [Com]: php_network_getaddresses: getaddrinfo failed

[email protected] ("kostello at gmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=11058&edit=1

 ID:                 11058
 Comment by:         kostello at gmail dot com
 Reported by:        pat at mail dot rit dot edu
 Summary:            php_network_getaddresses: getaddrinfo failed
 Status:             Not a bug
 Type:               Bug
 Package:            Network related
 Operating System:   OpenBSD 2.6
 PHP Version:        4.0.6
 Block user comment: N
 Private report:     N

 New Comment:

I have just encountered this issue twice on two separate virtual machines over the past 24 hours! These VMs are stable, the uptime was about one week for the first, about twelve hours for the second, when the errors occurred. They both run Ubuntu 14.04 LTS, nginx 1.8, PHP-FPM. More specifically, the first VM runs PHP 7.0.15-1+deb.sury.org~trusty+1, and the second one runs PHP 5.5.9-1ubuntu4.21. Here is the error message I get with file_get_contents($url)

>> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /script.php on line 276
>> Warning: file_get_contents(http://www.******.com/history.php): failed to open stream: php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /script.php on line 276)

NB: using CURL did not work either but did not return any data nor did it trigger any error message. However I assume that it is for the same reason.

Both times, I inspected the configuration: DNS resolvers, permissions on /etc/hosts, on /etc/resolv.conf, and other things, all good. Furthermore, no DNS issues to report when using "wget" or "svn update" or any other network tool - it was really just PHP. To rule out a possible error in my own PHP scripts, I created a simple "test.php" file with one line: file_get_contents('http://www.google.com') and the error still occurred.

The only way I could got rid of the problem in both cases was doing a "service php-fpm restart". As the issue was critical, I had to quickly proceed with the restart and I didn't have time to investigate further. How can I make sure this doesn't happen again?


Previous Comments:
------------------------------------------------------------------------
[2015-09-30 15:24:30] piet at ibuildings dot nl

Today I had a problem resolving google.com, I got the following error msg:
php_network_getaddresses: getaddrinfo failed: No address associated with hostname

Using the default Fedora 22 packages:
Apache/2.4.16 (Fedora)
PHP 5.6.13 (cli) (built: Sep  3 2015 12:18:26)

When I started my pc in de morning I had no issues resolving a hostname. Somewhere during the day it went wrong. Restarting Apache solved the problem.

How can be addressed as 'Not a bug'!? It took 1 hour of my time figuring out that a basic PHP function was failing me.

------------------------------------------------------------------------
[2014-12-17 10:07:11] rakeshpatil919 at gmail dot com

i m tryng to get image type by using getimagesize() function from remote network sometimes its working perfect but sometimes its showing 

A PHP Error was encountered

Severity: Warning

Message: getimagesize(): php_network_getaddresses: getaddrinfo failed: Name or service not known

------------------------------------------------------------------------
[2014-07-16 22:45:15] tino dot spirit at gmail dot com

This is not a PHP Bug !
It's a server misconfiguration

Check out my thread at :

http://serverfault.com/questions/612992/nginx-and-php-cant-resolve-hostname-and-make-connection-with-fqdn

I've shared some of my gathered solutions there.

------------------------------------------------------------------------
[2014-04-10 09:05:11] federico dot puntoni at trackset dot com

Still present on 5.3.28

Put the address on /etc/hosts and resolve.

------------------------------------------------------------------------
[2013-04-17 11:28:18] frolow at mail dot ru

rb - descriptor
By HelpSet.ru

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=11058


--
Edit this bug report at https://bugs.php.net/bug.php?id=11058&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.