So I tried loading my website and got the following error:
Warning: mysqli_real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/linuxbyimraan.co.za/wp-includes/wp-db.php on line 1633
Warning: mysqli_real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/linuxbyimraan.co.za/wp-includes/wp-db.php on line 1633
php_network_getaddresses: getaddrinfo failed: Name or service not known Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at linuxbyimraan.chlkhmqtrosy.eu-central-1.rds.amazonaws.com. This could mean your host’s database server is down.
Are you sure you have the correct username and password?
Are you sure you have typed the correct hostname?
Are you sure the database server is running?
If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.
So I knew none of the possible reasons provided were the cause and tried figuring out for a while why it was failing to load. Even though the error sez its database related, I knew it wasn’t. Also, I couldn’t recover using an AMI as my lifecycle policy takes snapshots every 24 hours and deletes the older ones so my issue was that the latest snapshot had the same problem. I checked..!!!
After days of troubleshooting and log diving, I hit me. This is a wordpress website, which are prone to plugin failures. So with this in mind, I ssh’d into the instance and I deleted the last three plugins I installed as I wasn’t sure which of the plugins were the issue.
After deleting them, I restarted apache and boom…. Issue resolved.
Hope this helps, as none of the forums I looked at and trust me I looked at quite a bit had an idea of the possible solution. WordPress blames the host provider…… ofcourse.