PHP Update Required in WordPress – How to Upgrade PHP [Digitalocean]

A few months back, I migrated one of my WordPress blogs to Digitalocean by creating WordPress Droplet using their One-Click solution. A few days ago I saw the warning message on the WordPress dashboard regarding the PHP version installed on the ubuntu server. (When you use the one-click WordPress App, you get Ubuntu server on DO).  This blog is on 5.5.9-1ubuntu4.19. Server

I tried to upgrade my WordPress from 5.1 to 5.2, but I am not able to run an upgrade due to the older PHP version installed on the server. 

PHP Update Required in WordPress – How to Upgrade PHP [Digitalocean] 1

You cannot update because WordPress 5.2.2 requires PHP version 5.6.20 or higher. You are running version 5.5.9-1ubuntu4.19.

Upgrade PHP version of Ubuntu Server on DigitalOcean

Before you get started – Make sure you create a backup. Take Snapshot

1. Log on to your Ubuntu server – (I use PuTTY)

2. Check your current PHP version:

$ php -v

3. Add a PPA for PHP 7.3 Packages

$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update

4. Run upgrade 

$ sudo apt-get install php7.3

Installing most of the common Php packages can be achieved by using:

sudo apt-get install php7.3-fpm php7.3-cli php7.3-mysql php7.3-gd php7.3-imagick php7.3-repre php7.3-tidy php7.3-xmlrpc

5. Restart Php & Nginx

sudo systemctl restart nginx.service
sudo systemctl restart php7.3-fpm

That’s it! you are now running PHP 7.3 and you can upgrade your WordPress and plugins. Happy Blogging!