Hi all,

I host 2 WordPress sites using Apache(httpd) on my droplet and am getting the nagging message to upgrade my version of PHP. I’ve found some tutorials and article on installing PHP, but nothing regarding upgrading from one version of PHP to another, and nothing particularly for CentOS 8. Can anyone give me some pointers or offer any advice on how to safely upgrade from PHP 7.2 to 7.4?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

Hi @jplafata,

In order to upgrade from one PHP version to another just need to install it. There is no actual upgrade process like upgrading from Ubuntu 16 to 18. You just install your new PHP version and make that the default one.

Anyway, let’s see how to install PHP 7.4

To get started, you need to add EPEL & Remi repository from where you will be able to install PHP 7.4 on CentOS 8 Linux.

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Next once you have the EPEL repository, run:

dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Upon successful addition of EPEL and Remi repositories, execute the command below to get a list of available PHP module streams.

 dnf module list php

You should see an output of PHP version. The one we care about is remi-7.4, the latest PHP stream, To enable the module stream run the following :

dnf module enable php:remi-7.4

Once the PHP remi-7.4 module has been enabled, you can then proceed and install PHP

dnf install php php-cli php-common


Submit an Answer