Install PHP 7.1, 7.2, 7.3 on CentOS 7
I currently have PHP 5.6 and PHP 7.0 installed on my CentOS 7 server. Both of these versions are EOL (end of life). How can I upgrade to later versions of PHP?
There's a few steps involved in upgrading your PHP installation on CentOS 7, including making sure old versions are uninstalled, getting the right repositories, and installing whichever version and type of PHP is required for your applications.
Uninstall Current PHP version
To view your current PHP related packages, you can run the following command:
yum list installed php*
From here, you can uninstall any necessary packages by running the command below, replacing <package></package> with the name of your package.
yum remove <package>
The core repositories of CentOS 7 do not have the most recent versions of PHP. To get them, you'll need to install the EPEL and Remi repositories:
yum install epel-release yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Install the Required PHP version
There are multiple versions and packages for PHP. Currently, the latest PHP version is 7.3, but 7.4 will be released soon and earlier versions of PHP may still be supported.
In addition, there are two main packages for php:
php-fpm. The one you choose to install is entirely up to you and your software applications. Users of nginx typically use
php-fpm, while users of Apache might use
For example, to install and run PHP-FPM 7.3, use the commands:
yum install php73-php-fpm systemctl start php73-php-fpm
You may also need to install other required packages and configure your web server to use the new PHP version.
Installing Multiple PHP versions
If you need to install Multiple PHP versions on a single Linode, some different/additional configuration is required. There's another community post that discusses this and recommends PHPBrew: