
Running D7 and D8 on the Same PHP Version
Published: 2/7/2018
A PHP upgrade might be required/desired for various reasons, including functionality, performance, and security. But what happens to Drupal when PHP is upgraded?
Drupal 7 sites are compatible with PHP 5.2.4 and up (opens in new tab), but once you get to PHP 7x, there's some uncertainty with contributed modules.
I recently upgraded PHP from 5.5 to 7.1 on a test server I use for both D7 and D8 sites. Although my D8 sites were functional on the older PHP version, contributed modules had version-specific requirements. The LDAP (opens in new tab)module, for instance, could not be enabled with PHP version 5.5.
On PHP 7.1, one of my D7 sites was completely broken - I'm talking Server 500 Error on any node. In the Watchdog logs, I found a PHP error referencing the HTTPRL (opens in new tab)module. Disabling the module did not resolve the problem; I had to uninstall and completely remove the module folder before the site was functional again.
In the HTTPRL documentation, PHP 5 is indicated as a requirement, and as of today, it's uncertain whether the module will be ported to D8. Boost (opens in new tab)is my current caching solution, and my usage of HTTPRL is due to Boost Crawler's dependency. Although there is chatter (opens in new tab) about the need for a Boost-like solution in D8, this module also has not yet been ported.
Bottom line, you may be able to run D7 and D8 Core on the same version of PHP, and many contributed modules will work. But install enough contributed modules, and you're likely to find an issue.
