Upgrade PHP on RedHat 7 and CentOS 7
You should almost always upgrade to the latest version of PHP supported by ownCloud, if and where possible. And if you’re on a version of PHP older than 7.4.0 you must upgrade. This guide takes you through upgrading your installation of PHP to one of the supported PHP versions (7.4) on Red Hat or CentOS 7.
To upgrade to PHP 7.4 you first need to subscribe to the Red Hat Software Collections channel repository to download and install the PHP 7.4 package in RHEL 7 (if you’ve not done this already). This documentation uses the same command as you will find there.
Ensure that you have
Install subscription manager
Add the required repositories for the PHP packages
Then, proceed by installing the required PHP 7.4 packages. You can use the command below to save you time.
yum install \ rh-php74 \ rh-php74-php \ rh-php74-php-cli \ rh-php74-php-curl \ rh-php74-php-devel \ rh-php74-php-gd \ rh-php74-php-intl \ rh-php74-php-ldap \ rh-php74-php-mbstring \ rh-php74-php-mysqlnd \ rh-php74-php-opcache rh-php74-php-pdo \ rh-php74-php-pear \ rh-php74-php-xml \ rh-php74-php-xmlrpc \ rh-php74-php-zip
Next, you need to enable PHP 7.4 and disable PHP 5.6 system-wide. To enable PHP 7.4 system-wide, run the following command:
cp /opt/rh/rh-php74/enable /etc/profile.d/rh-php74.sh source /opt/rh/rh-php74/enable
Then, you need to disable loading of the PHP 5.6 Apache modules. You can do this either by changing their names, as in the example below, or deleting the files.
mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php56.off mv /etc/httpd/conf.modules.d/10-php.conf /etc/httpd/conf.modules.d/10-php56.off
With that done, you next need to copy the PHP 7.4 Apache modules into place; that being the two Apache configuration files and the shared object file.
cp /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php74-php.conf /etc/httpd/conf.d/ cp /opt/rh/httpd24/root/etc/httpd/conf.modules.d/15-rh-php74-php.conf /etc/httpd/conf.modules.d/ cp /opt/rh/httpd24/root/etc/httpd/modules/librh-php74-php7.so /etc/httpd/modules/