So I keep sporadically getting 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 no particular event. I haven't changed anything relating to the database connection etc. I will make some requests, and it will be working fine, then will get this for a few seconds / minutes, then it will go back to working again.
$this->connection = new PDO('mysql:host='.DB_SERVER.';dbname='.DB_NAME, DB_USER, DB_PASS);
My host is similar to the following. Its a subdomain from my ISP, which shouldnt make any difference.
define("DB_SERVER", "name.plus.com:3306");
The machine is self hosted, so no AWS as this similar question here - "PDO exception: php_network_getaddresses: getaddrinfo failed" after changing DNS resolvers, with DB running on AWS
Its running on some docker containers. I have rebooted the actual machine too.
Why would it just randomly be unable to resolve that domain at certain points, and then work fine?