How to Update PHP 7.x to 7.4 on CentOS
Kevin Amayi
Feb 02, 2024
This article shows the steps to update the PHP version in CentOS from version 7.x to 7.4.
How to Update the PHP Version in CentOS From Version 7.X to 7.4
-
Update the operating system packages.
yum update -y
-
Check your PHP version in CentOS.
php -v
-
Print list of PHP packages already installed.
rpm -qa | grep php rpm -qa | grep php > php_rpm.txt
-
Remove PHP installed packages.
yum remove "php*" -y
-
Install updated
remi
repository.yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
-
Install
yum
util packages.yum install yum-utils
-
Install PHP 7.4
yum install php74
-
Install additional packages needed by PHP 7.4
yum install php74-php-xxx
-
Install testing packages needed by PHP 7.4
yum --enablerepo=remi-test install php74-php-xxx
-
Disable PHP 7.x and enable PHP 7.4
yum --disablerepo=remi-php7x --enablerepo=remi-php74 install php php-pdo php-fpm php-gd php-mbstring php-mysql php-curl php-mcrypt php-json -y
-
Confirm PHP version installed.
php -v
-
Restart
apache
to activate and use the new PHP version 7.4 installed.systemctl restart httpd