Since Centos ships with an old PHP version, there are many tutorials on how to install Remi PHP which enables you to use more modern versions of PHP on your site. But when it came time to update from PHP72 to php73/4 I couldn’t find a lot of docs on this so I decided to put this one up to remind me next time am doing this.
First, we will need to enable the PHP version we want to install such as below.
# yum-config-manager --enable remi-php73 # yum-config-manager --enable remi-php74
In my case, I was moving from php72 to 73 before 74 so I enabled 73 and disabled 72.
# yum-config-manager --enable remi-php73 # yum-config-manager --disable remi-php72
After enabling the version you want to move to and disabling your current version, run yum update and restart your webserver.
# yum update # apachectl restart
To validate the update was successful check the current version of PHP as reported in your terminal, and those are the steps needed to move from one Remi PHP version to another.
# php -v PHP 7.3.29 (cli) (built: Jun 29 2021 09:30:31) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.29, Copyright (c) 1998-2018 Zend Technologies