Therefore, I periodically spontaneously receive the following error:
Type: PDOException
Code: 2002
Message: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
File: /var/www/html/system/db.php
Line: 71
It started randomly after a specific event. I have not changed anything related to connecting to the database, etc. I will make some requests, and it will work fine, and then it will be for a few seconds / minutes, and then return to work again.
$this->connection = new PDO('mysql:host='.DB_SERVER.';dbname='.DB_NAME, DB_USER, DB_PASS);
My host is like the following. Its a subdomain from my provider, which should not make any difference.
define("DB_SERVER", "name.plus.com:3306");
The machine itself is organized, so there is no AWS, as this similar question is here - "PDO exception: php_network_getaddresses: getaddrinfo failed" after changing DNS resolvers, with a database running on AWS
. .
, ?