简体   繁体   中英

file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known with Nginx

Out of the blue I started receiving this error whenever I tried to use file_get_contents (or curl).

I run Nginx on Ubuntu, and I believe it's an issue in Nginx, because if I try to run the same file from the server (php file.php), it works perfectly.

What could cause this issue?

Just happened the same to me on Ububntu + Apache. Restarted the server and it magically just fixed the issue.

Restarting will fix it temporarily, but it will come back. An update caused this issue: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1674733

I'm experiencing the same issue on two different servers.

For me restarting PHP resolved the issue (temporarily).

sudo service php7.0-fpm restart

I'm affected about once a day by the problem. Therefore I set up a cronjob to restart PHP every hour. I hope there will be a real fix as soon as possible.

My environment: Ubuntu 16.04 @AWS EC2 PHP 7.0

MySQL 5.6 @AWS RDS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM