On this page:
I used the WordPress app on my phone to write the last post about writing. Normally, the app displays a list of the tags used in the entire blog. However, this time, the app came up with some weird error that prevented the tags from being loaded.
I didn’t know what to do about the error, so I transferred to a browser, which displayed yet another error, a new one to me:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
This seemed odd considering it had been working throughout the day. Where had the extension gone? Was there some sneaky security update that required it? Was it because I’d updated the server’s OS and auto-removed a load of packages? Had the wrong package been removed?
The faffing about
The internet, by and large, didn’t help. It talked about files called info.php and PHP versions and a MySQL extension, mysqlnd, that is required by WordPress but that are no longer required after a certain version of WordPress. It talked about not being up to date with WordPress, a clash of versions between WordPress and PHP, and all sorts of other things.
My installation of WordPress is up to date: 5.9, which was the latest at the time. So that wasn’t it.
I looked at info.php, but didn’t find half the things the internet mentioned. I found the version of PHP it listed (7.x), which was different to the version that running php --version on the command line gave me (8.x). I tried installing the mysqlnd package, but it told me it was going to look for mysql instead, whether I installed it for PHP 7.x or 8.x, and that they were each up to date already. So that wasn’t it.
I tried turning the server off and on again (i.e. rebooting it), but that didn’t fix anything except the warning on log-in that the system needed to reboot.
Almost drowned out by all of this noise was the instruction to restart the apache server. I thought I’d try that: it seemed easier and safer than modifying the stuff displayed in info.php. I found a page that reluctantly told me how to restart apache. It preferred me to reload rather than restart apache to minimise downtime. I thought I might as well give it a go. So I did:
sudo service apache2 reload
You can also use:
sudo systemctl reload apache2
I wasn’t convinced it would work, but lo and behold, when I went back to my browser, my website was back up.
So the problem was that apache had somehow got its knickers in a twist, but was easily rectified by reloading it.