Error connecting to DB in /wp-includes/wp-db.php on line 1538 [closed]

new in wordpress world.

My wordpress page keeps failing. It works from time to time, meaning refreshing sometimes offer the page, others it offers the Error establishing a database connection page.

Checking the wp-content/debug.log it says:

PHP Warning:  mysqli_real_connect(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /www/wp-includes/wp-db.php on line 1538

As far as I know, this file is a wordpress one so no one has touched it.

Any ideas from where it can come?
Any experience or tips on what to do?

1 Answer
1

Are you running on Ubuntu? Library libc was recently updated, and if you have unattended-upgrades enabled, that will be the cause. A restart of PHP-FPM, Apache, Nginx will solve it. Even better if you could reboot the entire server to be sure.

libc is the C implementation for Linux, and PHP runs on C.

Leave a Comment