Tag Archives: rds database connection failed

PHP link database error PHP_ network_ getaddresses: getaddrinfo failed: Name or service not known

error:

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

environment: thinkphp framework, Linux, ali cloud RDS database

ping link address normal:

error reporting process: access the background address, most are normal access, refresh 10-20 times may appear 1-2 error, not continuous error

solution 1:

restart php-fpm service

service php-fpm restart 

the original view: https://stackoverflow.com/questions/2661546/php-network-getaddresses-getaddrinfo-failed-name-or-service-not-known

special thanks to: https://blog.csdn.net/qq_37500838/article/details/85008432#commentBox

solution 2:

configure DNS resolution to 114.114.114.114

check DNS configuration: cat /etc/resolv.conf

I use the first solution, the second solution is temporarily useless, configuration method can be found on the Internet