now has a health check you can run against your site to make sure it has all the latest bells and whistles. You can find it under Tools > Site Health — this is new to me, but I haven’t used WordPress in years.
My health check had some straightforward items — including to remove themes I wasn’t using. But there were two that I knew I would have to get my hands dirty for — upgrading PHP to at least 7.3, and installing the PHP extension
imagick. I had to bumble around the Internet to figure out all the steps, so I figured I’d detail my findings here to make sure I understood what I did.
I decided to go straight to PHP 7.4 since it’s the latest and this WordPress blog doesn’t have a lot of customization. On my host DigitalOcean, Ubuntu 18.04 comes with PHP 7.2 by default. So first thing was to SSH into the box and start getting the relevant packages.
$ apt-get install software-properties-common $ add-apt-repository ppa:ondrej/php $ apt-get update $ apt-get install php7.4
software-properties-common was already installed, but I’m pretty sure it enabled me to add the Personal Package Archive (PPA) on the next line. It looks like Ondřej Surý maintains the PPA for PHP — seems odd, but I saw multiple sources cite this repo so I went ahead with it. Then I ran a standard
apt-get update and installed PHP 7.4 next.
For a sanity check, I ran
php --version and was surprised it was on 7.4! But alas, this wasn’t enough for WordPress to start using it. So next I had to figure out how to get off of PHP 7.2.
Loading PHP Via Apache
This part was cool b/c I learned more about how Apache works! In the
/etc/apache2/mods-available directory are a list of available mods for Apache to use, including
php7.2.load and the newly installed
php7.4.load. My gut told me I had to enable PHP 7.4 and disable 7.2, so that’s exactly what I did.
$ a2dismod php7.2 $ a2enmod php7.4 $ systemctl restart apache2
Loading Remaining WordPress Libraries
There was a DigitalOcean tutorial that suggested I install the following commonly-used WordPress PHP extensions.
$ apt-get install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
Of course that wasn’t enough. After making Apache configurations above and restarting, I was told I needed to install the MySql extension.
$ apt-get install php-mysql
This worked! Now that I had WordPress running on 7.4, I went ahead with the remaining
$ apt-get install php-imagick