Upgrade PHP from version 7.2 to 7.4 on CentOS

  1. Add the Remi repository to your system:
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  1. Enable the Remi repository for PHP 7.4:
sudo yum-config-manager --enable remi-php74
  1. Install PHP 7.4:
sudo yum install php
  1. If you have any PHP modules installed, you will need to reinstall them for PHP 7.4. You can do this by running the following command:
sudo yum install <module-name>

Replace <module-name> with the name of the PHP module you want to install (e.g. php-mysql).

  1. Update your PHP scripts to use the new version of PHP. This may involve updating any PHP code that uses deprecated functions or features, or making changes to configuration files such as php.ini.
  2. Restart your web server to apply the changes. For example, if you are using Apache, you can restart the server with the following command:
sudo systemctl restart httpd

That’s it! You have now updated PHP from version 7.2 to 7.4 on CentOS.