RHEL 7 upgrade PHP7 to 8

This article will show you how to upgrade PHP7 to PHP8 on RHEL 7

Check you current PHP version

php -v

# Example output:
PHP 7.4.27 (cli) (built: Dec 14 2021 17:17:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

Install PHP8

# Disable current PHP repo
sudo yum-config-manager --disable 'remi-php*'

# Enable PHP 8 repo
sudo yum-config-manager --enable   remi-php81

# Install PHP and modules you need.
sudo yum -y install php php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json,opcache,redis,memcache}

# Verify your PHP version
php -v

# Example output
PHP 8.1.17 (cli) (built: Mar 14 2023 19:50:20) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.17, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.17, Copyright (c), by Zend Technologies
Scroll to Top