Send Docs Feedback

Upgrading to PHP 7.0.x

Developer Services Portal v. 4.16.05

To upgrade to PHP 7.0.x, you must have an internet connection in order to download the required RPMs to install. This procedure is not applicable to non-networked environments.

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.

PHP 7.0.x will issue more warnings than PHP 5.x. For example, it will warn you about certain code constructs which are deprecated and may be removed in a future PHP version. An up-to-date, out-of-the-box Dev Portal codebase should not generate such warnings, but if certain modules are out-of-date (such as CTools) you may receive warnings at the top of pages. In this case, you should update Drupal.

If you have created custom code (themes or modules), you should test your site thoroughly under PHP 7. Check for warnings at the top of pages and for PHP errors in recent status messages under Reports. Make sure you fix any issues here on a development box before upgrading your production server to PHP 7.

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).

    This step is required for Red Hat. It is recommended for CentOS, but not required.

    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).

    This step is required for both CentOS and Red Hat.

    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

    Note: If you wish to install PHP 5.6 instead of 7.0.x, replace php70u prefixes in the above command with php56u.

  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.

Help or comments?