skip to Main Content

This tutorial will show you how to upgrade PHP 5.4 to PHP 7.3 on CentOS 7.5 (1804).

I’m assuming that you are running a stock installation of CentOS, and already have PHP 5.4 installed.

 

1. Verify current version of PHP

Type in the following to see the current PHP version:

php -v

The output should match this:

PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Cool, let’s move on!

 

2. Install the REMI and EPEL repositories

If you don’t already have them, install the Remi and EPEL repositories:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm

Enable the Remi repository globally:

nano /etc/yum.repos.d/remi.repo

Under the section that looks like [remi] make the following changes:

[remi]
name=Remi's RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/remi/$basearch/
#mirrorlist=https://rpms.remirepo.net/enterprise/7/remi/httpsmirror
mirrorlist=http://cdn.remirepo.net/enterprise/7/remi/mirror
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Type CTRL-O to save and CTRL-X to close the editor

Enable the Remi PHP7.3 Repository:

nano /etc/yum.repos.d/remi-php73.repo

Under the section that looks like [remi-php73] make the following changes:

[remi-php73]
name=Remi's PHP 7.3 RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/php73/$basearch/
mirrorlist=https://rpms.remirepo.net/enterprise/7/php73/httpsmirror
mirrorlist=http://cdn.remirepo.net/enterprise/7/php73/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Make sure you un-comment the HTTPS mirror-list as well. The HTTP mirror seems to run into issues every now and then.

Type CTRL-O to save and CTRL-X to close the editor

 

3. Upgrade PHP 5.4 to PHP 7.3

Now we can upgrade PHP. Just type in the following command:

yum -y upgrade php*

Once the upgrade has completed, verify that you have PHP 7.3 installed:

php -v

Output should look like:

PHP 7.3.0RC5 (cli) (built: Nov  6 2018 10:22:47) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies

You’re now running with PHP 7.3!

Sponsored Links

Don't be shy, leave a reply!