From LUG
Jump to navigation Jump to search

Due to the fact that RHEL 7 is standard "supplied" with a PHP 5.4 version, which is no longer maintained. it is not possible to native install a PHP 7.0 or PHP 7.1 environment. But, there is the possibility to use the PHP 7.X versions which RedHat supplies through the SCL ( Software Collections Library). Be aware that PHP5.6.x and PHP7.X will not operate with the default apache/http package, you also need the SCL HTTP24 version

The Software Collections Library repository is available through the WUR Satellite environment.

use subscription manager to enable the repository:

sudo subscription-manager repos --enable=rhel-server-rhscl-7-rpms

Now the proper packages can be installed ( and maintained ) through the Yum Package manager:

sudo yum install httpd24 httpd24-mod_ssl rh-php70 rh-php70-php

Now the whole new daemon chain is installed in /opt/rh. In order to start the web-service with the new daemon first disable the "original" httpd service:

sudo systemctl stop httpd && sudo systemctl disable httpd

Next enable the new httpd24 daemon:

sudo systemctl enable httpd24-httpd

Copy ( or symlink) the original document root to the proper location:

sudo cp -pr /var/www/html/* /opt/rh/httpd24/root/var/www/html/

to test if the proper php version is active, you can insert a small phpinfo file:

<?php phpinfo(); ?>

Start the httpd24 service:

sudo systemctl start httpd24-httpd

Be aware that not all prePHP7 code can be run through PHP7.x