OK I get this about three weeks or so on our new DigitalOcean Droplet running WordPress. The good news is the JetPack does inform you when it dies.
On Bluehost, this basically has never happened. A restart of the droplet seems to help, but it would be good to figure out what is going on.
This is a very common problem and WP Beginner has a diagnostic set.
- See if your host is up. A quick ssh can check to make sure the Droplet is still running.
- Does the problem occur with the administrative interface
/wp-admin/
. If it says the database needs to be repaired, then you can adddefinte('WP_ALLOW_REPAIR', true
towp-config.php
and you can fix it and then go tohttp://yoursite.com/wp-admin/maint/repair.php
- Check your WP-Config.php file and if you didn’t change your database password (why would you?), then you make need to change the DB_Host from localhost to
define('DB_HOST', '127.0.0.1:8889
but this didn’t work either. Or try 3306 - See if MySQL Server is up and running. You need a sample application that tests this.
<?php
$link
= mysqli_connect('localhost', 'username', 'password');
if
(!$link) {
die('Could not connect: '
. mysqli_error());
}
echo
'Connected successfully';
mysqli_close($link);
?>
How to debug Mysql
OK, so that wasn’t of much help, time to figure out what to do when Mysql is unavailable. DigitalOcean has a good tutorial on this:
- Look at the error log, they are kept in
var/log/mysql/error.log
and it was pretty revealing, the last line was/usr/sbin/mysqld: Shutdown complete
- Looking up it says,
Failed to initialize builtin plugins
and then it shows that InnoDB failed because it could not allocate buffer memory.
So I”m wondering if my 1GB tiny WordPress Droplet is too small and StackOverflow confirms that it will not run in a $5/month droplet because of memory shortages. You need more RAM and you should allocate a Block Volume.
Restarting Mysql
To test this, you can just restart Mysql with service mysql restart
and see if it works It won’t tell you what is really wrong, but will get you going again.
No Swapfile for WordPress Droplet installations
Ok, part of the problem seems to be that there is no swapfile for the DigitalOcean droplet. That is swapon -s
reveals nothing and there is no /swapfile
If you already have a swapfile, here is how to increase the size, first turn off the swap and then first disable the swapfile and delete. See https://askubuntu.com/questions/1075505/how-do-i-increase-swapfile-in-ubuntu-18-04
sudo swapoff /swapfileâŠsudo rm /swapfile
The other thing it could be is that Apache is overloading because of too much access to XMLRPC, but that doesn’t seem like the problem. With Ubuntu 18.04, a swapfile can be just about anything, but by convention, /swapfile
is used, so to create one, it looks like to create a 2GB swapfile
dd if=/dev/zero of=/swapfile count=2K bs=1MâŠmkswap /swapfileâŠsudo chown root:root /swapfileâŠsudo chmod 600 /swapfileâŠsudo swapon /swapfile