If you came here to upgrade CentOS 7’s PHP to version PHP 8.0/8.1, you’re at the right place.
The new documentation doesn’t mention CentOS 7 anymore only Steam. But in the archive it’s there.
You need to do this:
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm && yum clean all
yum -y install php83-php-{cli,pdo,fpm,zip,gd,xml,mysqlnd,opcache}
yum -y install php81-php-{cli,pdo,fpm,zip,gd,xml,mysqlnd,opcache}
yum -y install php80-php-{cli,pdo,fpm,zip,gd,xml,mysqlnd,opcache}
Original Article
CentOS has a software collections repo that allows you to install multiple PHP versions. If you just prefer to upgrade the PHP on your box, see this article instead: https://www.virtualmin.com/node/48280. Please note this link provided to install to upgrade PHP version of your box might clash with the side-by-side method described below.
To install multiple PHP versions on a Virtualmin control panel:
yum install centos-release-scl yum install rh-php72 rh-php72-php-mysqlnd
Substitute the “72” with whichever version of PHP that you want to install.
Now login to Virtualmin and do:
System Settings -> Re-Check Configuration
You should get a notice that a new version of PHP was installed and configured, for example:
The following PHP versions are available : 5.4.16 (/bin/php-cgi), 7.0.27 (/opt/rh/rh-php70/root/usr/bin/php-cgi), 7.1.8 (/opt/rh/rh-php71/root/usr/bin/php-cgi), 5.4 (mod_php)
Note:
Just because you installed PHP from the command line doesn’t mean every single package you need to run your applications will be available.
The “rh-” format can be used to install any missing PHP package.
For example, let’s say you want to install GD Graphics Library. for PHP 7.2:
yum install rh-php72-php-gd
or 7.1:
yum install rh-php70-php-gd
An example for PHP 7.1:
yum install rh-php71-php-bcmath
Reference:
https://www.virtualmin.com/documentation/web/multiplephp