Upgrading to PHP 7.0.x

Developer Services Portal v. 4.16.05

As of July 21, 2016, PHP no longer supports versions older than 5.6. By default, Red Hat/CentOS 6 install PHP 5.3.3, and Red Hat/CentOS 7 install PHP 5.4.16. This section describes how to upgrade to PHP 7.0.x.

Before you start, it is recommended that you:

  • Familiarize yourself with the complete set of steps before stepping through them.
  • Try the upgrade to a VM snapshot first, to ensure that you don't encounter any problems.

To upgrade to PHP 7.0.x:

  1. Enable the EPEL RPM repository (if not already enabled).
    1. First, verify whether the Extra Packages for Enterprise Linux (EPEL) RPM repository is already enabled:
      rpm -q epel-release
      
    2. If no results are returned, then enable the EPEL RPM repository.

      For Red Hat 6 or CentOS 6, enter:

      rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
      

      For Red Hat 7 or CentOS 7, enter:

      rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
      
  2. Enable the IUS RPM repository (if not already enabled).
    1. First, verify whether the Inline with Upstream Stable (IUS) RPM repository is already enabled:
      rpm -q ius-release
      
    2. If no results are returned, then enable the IUS RPM repository.

      For CentOS 6, enter:

      rpm -Uvh https://centos6.iuscommunity.org/ius-release.rpm
      

      For CentOS 7, enter:

      rpm -Uvh https://centos7.iuscommunity.org/ius-release.rpm
      

      For Red Hat 6, enter:

      rpm -Uvh https://rhel6.iuscommunity.org/ius-release.rpm
      

      For Red Hat 7, enter:

      rpm -Uvh https://rhel7.iuscommunity.org/ius-release.rpm
      
  3. Stop Apache:
    service httpd stop
    
  4. Get a list of all installed PHP packages:
    rpm -qa | grep -i php
    
  5. Remove all existing PHP RPMs, listed in step 4 above:
    yum remove php php-common php-cli ...
    
  6. Install PHP 7 RPMs from the IUS repository:
    yum install php70u php70u-cli php70u-pdo php70u-mysqlnd php70u-gd php70u-xml php70u-mbstring php70u-process php70u-json
    
  7. Start Apache:
    service httpd start
    
  8. Confirm that the version is 7.0.x:
    php --version
    

    In addition, ensure that the following returns a list of Drush commands (and not error messages):

    /usr/local/bin/drush help
    
  9. Test the results in the browser:
    1. Navigate your browser to the site and log in as an administrator.
    2. Under Reports, select Status report.
    3. Confirm that there are no red items pertaining to missing PHP modules.