Most modern web applications require a modern version of PHP, since RHEL/CentOS comes with 5.4 those requirements can’t always be met.
To upgrade to a more recent version of PHP you have a few options. Depending on the environment you might choose one over another.

  1. RHEL/CentOS Software Collections (SCL)
  2. 3rd Party repository such as Remi

I’ll go through the second approach, I might or might not do a SCL edition of this post (probably not).
Remi provides a nice configuration wizard if you want to go for another distro/PHP version.


Update your system

Get the latest updates for your CentOS server

[root@centos ~]# yum update


Add the EPEL repo to your system

You’ll need to have the EPEL repository installed.

[root@centos ~]# yum install epel-release


Add the Remi repo to your system

PHP will be installed from this repository

[root@centos ~]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm


Install yum-utils

Used to manage yum repositories

[root@centos ~]# yum install yum-utils


Enable the remi-php73 repo

That will enable the installed repository

[root@centos ~]# yum-config-manager --enable remi-php73


Upgrade PHP

This will upgrade PHP 5.4 to PHP 7.3

[root@centos ~]# yum update