Categories
CMS Hosting Platform UT Drupal Kit

PHP 7, the UT Drupal Kit, and You!

For some time now, the buzz in the PHP community has been about the amazing performance increases that can be seen from simply updating an application from PHP 5.x to PHP 7 (for those just joining in, there is no PHP 6). Check out this infographic from Zend to see visualizations of the differences between PHP 5.6 and PHP 7 on common PHP frameworks, including Drupal and WordPress. For Drupal sites, measured performance gains with PHP 7 can be over 60%.

While PHP 7 is not yet available on UT Web, it is available on Pantheon for those using the CMS Hosting Platform service. And enabling PHP 7 on a Pantheon site is as simple as adding a `pantheon.yml` file to your site’s docroot and specifying the PHP version for the site as “7.0.”

api_version: 1
php_version: 7.0

However, while Drupal 8 has documented 100% support for PHP 7, most of us at UT, and everyone using the UT Drupal Kit (UTDK) distribution, are still living the Drupal 7 life. And PHP 7 support is still not 100% guaranteed for Drupal 7. So, we should be more circumspect about moving ahead, and take a close look at both Drupal core and all of the contrib and custom code that is included both in the UTDK as well as individual sites.

Testing the UTDK Distribution

In the ITS Drupal team, we have used a variety of methods to test whether all code that ships with the distribution since version 2.6 is compatible with the latest releases of PHP 7. This testing effort has taken the following forms:

  • Running the UTDK’s Behat test suite under PHP 7
  • Installing the UTDK codebase on Pantheon in a site instance configured to use PHP 7
  • Running static code analysis against the UTDK codebase

The static code analysis tool that we have used for PHP 7 testing is called “PHP 7 Compatibility Checker,” and is available from Github. The only issue identified with this tool is an error identifying a deprecated PHP 4-style constructor method used by the “Diff” module, which has been fixed in the module’s latest dev release.

Updating Your Site

If you are running a UT Drupal Kit-based site on Pantheon, and have made absolutely ZERO code customizations to your site — no custom modules, no extra contrib modules, and no custom theme — then it should be safe to update your site to PHP 7. But even in that situation, we recommend carefully following Pantheon’s recommendation for testing the new PHP version in your DEV and TEST environments before promoting to LIVE.

If you are running a UTDK-based site on Pantheon and have added any custom or contrib code to your modules or theme(s), then we recommend first reviewing the PHP.net documentation on updating from 5.6.x to 7, and then running the PHP 7 Compatibility Checker tool against your site’s codebase before attempting to update. Once you are satisfied that your code passes the tool, then you can proceed with testing PHP 7 in your DEV and TEST environments, before promoting to LIVE.

If you’re interested in digging deeper into technical benchmarks on the difference between PHP 5.6.x and 7, check out this blog post from Pantheon: “Measuring PHP 7 Performance with New Relic: #NoBSBenchmarks.” As mentioned in the post, all Pantheon sites include the New Relic Pro Application Performance Monitoring (APM) tool, which allows you to easily browse through visualizations of application performance for various operations. Combined with the ability to automate deployment markers in NewRelic through Pantheon’s QuickSilver Platform Hooks API, you can see the difference on your site with your own eyes.

By Paul Grotevant

Paul Grotevant is the Senior IT Manager of Web Content Management Solutions for Information Technology Services at the University of Texas at Austin.