In response to WordPress warning about the version of PHP, I decided I should upgrade:

My WordPress operates on an EC2 instance and steps to update are described below:

STEP 1

ssh to the EC2 instance with PuTTY or similar (I’m using WSL – Windows Subsystem for Linux to connect from a Ubuntu shell).

STEP 2

Update the system, note this does not update php:

sudo yum update

STEP 3

Check the version of PHP and make sure the amazon-linux-extras package is installed:

$ php -v
$ which amazon-linux-extras

STEP 4

Verify the PHP7.x topic is available:

$ sudo amazon-linux-extras | grep php

STEP 5

Disable both the php7.2 and lamp-mariadb10.2-php7.2 topics

$ sudo amazon-linux-extras disable php7.2
$ sudo amazon-linux-extras disable lamp-mariadb10.2-php7.2

If you see the warning “Beware that disabling topics is not supported after they are installed.” it can be safely ignored.

STEP 6

Check the status of available topics

$ sudo amazon-linux-extras | grep php

STEP 7

Enable the php7.4 topic.

$ sudo amazon-linux-extras enable php7.4

STEP 8

Check with

$ sudo amazon-linux-extras | grep php

STEP 9

Update to PHP 7.4. First clean up the metadata and then install php along with any dependencies:

$ sudo yum clean metadata
$ sudo yum install php 

STEP 10

Check the version of PHP

$ php -v

STEP 11

Reboot the instance or just restart apache with:

$ sudo systemctl restart httpd

STEP 12

Test the WordPress site and verify