RHEL7 Software Collections – Migrate from PHP 7.1.X to 7.2.X

RHEL7 Software Collections – Migrate from PHP 7.1.X to 7.2.X

We needed to migrate our Drupal servers to a newer version of PHP. RedHat Software Collections is a little odd, but provides newer software and allows administrators to run multiple versions of PHP side-by-side.

Software Collections is replaced by Applications Streams in RHEL8. I basically wanted to quickly document the commands. If you are following this, please make sure you understand what each command does before running it in production.

sudo yum install rh-php72-runtime rh-php72-php-cli rh-php72-php-pear rh-php72 rh-php72-php-fpm rh-php72-php-zip rh-php72-php-process rh-php72-php-gd rh-php72-php-mbstring rh-php72-php rh-php72-php-common rh-php72-php-pdo rh-php72-php-devel rh-php72-php-ldap rh-php72-php-json rh-php72-php-xml rh-php72-php-mysqlnd

sudo sed -i 's/rh-php71/rh-php72/g' /etc/profile.d/enablephp7.sh

cat /etc/profile.d/enablephp7.sh

#!/bin/bash
source scl_source enable rh-php72

sudo ln -s /opt/rh/rh-php72/root/usr/bin/php /usr/bin/php

We double the memory limit.

sudo sed -i 's/128M/256M/g' /etc/opt/rh/rh-php72/php.ini

sudo pecl install oci8

echo 'extension=oci8.so' | sudo tee -a /etc/opt/rh/rh-php72/php.d/oci8.ini

We also wanted to remove an old newrelic client that was used for monitoring.

sudo rpm -qa | grep newrelic | xargs sudo yum remove -y

sudo rpm -qa | grep php71 | xargs sudo yum remove -y

Finishing up and making sure everything looks good.

sudo systemctl restart httpd24-httpd

sudo systemctl status httpd24-httpd

Leave a Reply

Your email address will not be published. Required fields are marked *