Website shows 500 Internal Server Error: php_network_getaddresses: getaddrinfo failed: Name or service not known

Created:

2017-01-24 11:05:59 UTC

Modified:

2017-08-08 13:44:36 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Website shows 500 Internal Server Error: php_network_getaddresses: getaddrinfo failed: Name or service not known

Applicable to:

  • Plesk for Linux

Symptoms

  1. The website is showing "Internal Server Error".
  2. The following error can be found in Apache error log:
    [fcgid:warn] [pid 7000:tid 140523360720640] [client 203.0.113.2:60389] mod_fcgid: stderr: PHP Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/vhosts/example.com/httpdocs/system/library/db/mysqli.php on line 7
    [fcgid:warn] [pid 7000:tid 140523360720640] [client 203.0.113.2:60389] mod_fcgid: stderr: PHP Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service no t known in /var/www/vhosts/example.com/httpdocs/system/library/db/mysqli.php on line 7
    [fcgid:warn] [pid 7000:tid 140523360720640] [client 203.0.113.2:60389] mod_fcgid: stderr: PHP Warning: DB\\MySQLi::__construct(): Couldn't fetch mysqli in /var/www/vhosts/example.com/httpdocs/system/library/db/mysqli.php on line 10
    [fcgid:warn] [pid 7000:tid 140523360720640] [client 203.0.113.2:60389] mod_fcgid: stderr: PHP Warning: DB\\MySQLi::__construct(): Couldn't fetch mysqli in /var/www/vhosts/example.com/httpdocs/system/library/db/mysqli.php on line 10
    [fcgid:warn] [pid 7000:tid 140523360720640] [client 203.0.113.2:60389] mod_fcgid: stderr: PHP Fatal error: Uncaught exception 'Exception' with message 'Error: Error No: ' in /var/www/vhosts/example.com/httpdocs/system/library/db/mysqli.php:10

Cause

Incorrect values in a connection string to MySQL server in PHP code. It is not possible to connect to MySQL server with specified credentials.

Resolution

Define correct values in the connection string to MySQL server in PHP code.

Have more questions? Submit a request
Please sign in to leave a comment.