(2024.2) PHP Upgrade RedHat/CentOS
NOTE: For an install these steps still apply, just skip any steps that remove or disable existing packages.
PHP 7.4 is not available from any repo on RedHat 6 or CentOS 6. The highest version it can be upgraded to is PHP 7.3.
For customers running PCR-360 Versions 2018.1 through 2020.2, PHP 7.2 is required.
For customers running PCR-360 Versions 2020.3 through 2020.4, PHP 7.2 or PHP 7.4 may be installed.
For customers running PCR-360 Versions 2021.1 or later, PHP 7.4 is required
For customers running PCR-360 Versions 2022.1 or later, PHP 7.4 or PHP 8.1 may be installed
Preparation
Update the installed packages
# get rooted
sudo su
# apply the cream
yum -y update
# If you run into a GPG key issue with the percona repo (or another package), reinstall the repo it and try to update again
# Example
sudo yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
yum -y update
STEP 1: Install the Repos
RHEL 8 / CentOS 8
# these are probably already installed
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
RHEL 7 / CentOS 7
# these are probably already installed
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
# RHEL ONLY
subscription-manager repos --enable=rhel-7-server-optional-rpms
RHEL 6 / CentOS 6
STEP 2: Configure the New Repos
RHEL 8 or CentOS 8 :
Disable the previously installed PHP Version
Reset PHP and enable the new version
RHEL 6, 7 or CentOS 6, 7 :
Disable the previously installed PHP Version
Enable the new PHP version
STEP 3: Upgrade PHP
RHEL 8 and Centos 8
To upgrade from previous php version :
RHEL6, 7 and Centos 6, 7
To upgrade from previous php version:
Update the PHP INI
STEP 4: Verify thcorrect version is Installed
Step 5: Restart Apache and PHP-FPM
RHEL 8, 7 and Centos 8, 7
RHEL6 and Centos 6
Troubleshooting the Upgrade
Because external customer owned servers are not maintained by PCR and often vary in their installations, these instruction may not work exactly as written.
Based on customer experiences running the upgrade, here some issue that may occur and how to resolve them:
PHP Warning: Failed loading Zend extension 'ZendGuardLoader.so'
The Zend Guard Loader PHP Extension is no longer used by PCR-360 and does not need to be reinstalled after removal. The extension may be safely removed if it remains after removing the previous version of PHP. These file paths may vary depending on the installation.
"Service Unavailable" 503 - attempt to connect to Unix domain socket /var/run/php72.sock (php-fpm72) failed
This can apply to any version. The old php module settings should be removed when installing, but this is not the case with some installations. In this instance, the settings file may need to be updated or removed manually. These file paths may vary depending on the installation.
The error may also occur if a the previous PHP installation was using a proxy to connect to to Apache. In this case the virtual host may need to be manually updated. To do this, first open the appropriate virtual host file (These file paths may vary depending on the installation):
Now look for and remove (or comment out) the following (or similar) lines. Then save the file and restart Apache. This line may appear multiple times if multiple virtual hosts are configured and may have more or longer parameters for the SetHandler method.
CRON Jobs Not Running or Running with Errors
If PHP was configured to use multiple versions , the CRON jobs may have been set to use a non standard executable. In this case the old executable (ex. /usr/bin/php72) may no longer exist and needs to be updated to the standard executable 'php'.