PHP 7.3 and when you can upgrade your Drupal site
PHP 7.3.0 was released in December 2018, and brings with it a number of improvements in both performance and the language. As always with Drupal you need to strike a balance between adopting these new improvements early and running into issues
PHP 7.3.0 was released in December 2018, and brings with it a number of improvements in both performance and the language. As always with Drupal you need to strike a balance between adopting these new improvements early and running into issues that are not yet fixed by the community.
Why upgrade PHP to 7.3 over 7.2?
- It is around 10% faster compared to PHP 7.2 - some basic benchmarks for Drupal on https://kinsta.com/blog/php-benchmarks/#drupal-benchmarks
- A bunch of quality of life improvements to the language - e.g. flexible heredoc and nowdoc syntaxes, allowing a trailing comma in function calls and better JSON parsing error messages (just to name a few). I would recommend reading this great blog post on the topic if you want to know more.
What hosting providers support PHP 7.3?
All the major players have support, here is how you configure it for each.
Acquia
Somewhere around April 2019 the option to choose PHP 7.3 was released. You can opt into this version by changing a value in Acquia Cloud. This can be done on a per environment basis.
Pantheon
Pantheon have had support since the April 2019 as well (see the announcement post). To change the version, you update your pantheon.yml
file (see the docs on this).
On a side note, it is interesting that PHP 5.3 is still offered on Pantheon (end of life for nearly 5 years).
Platform.sh
Unsure when Platform.sh released PHP 7.3, but the process to enable it is very similar to Pantheon, you update your .platform.app.yaml
file (see the docs on this).
Dreamhost
PHP 7.3 is also available on Dreamhost, and can be chosen in a dropdown in their UI (see the docs on this).
Dreamhost also win some award for also allowing the oldest version of PHP that I have seen in a while (PHP 5.2).
When can you upgrade PHP 7.3
Drupal 8
As of Drupal 8.6.4 (6th December 2018), PHP 7.3 is fully supported in Drupal core (change record). I have been running PHP 7.3 with Drupal 8 for a while now and have seen no issues, and this includes running some complex installation profiles such as Thunder and Lightning.
Any Drupal 8 site that is reasonably up to date, should be fine with PHP 7.3.
Drupal 7
Slated for support in the next release of Drupal 7 - being Drupal 7.68 (see the drupal.org issue), however there are a number of related tasks that seem like deal breakers. There also is not PHP 7.3 and Drupal 7 tests running daily either.
It seems like for the mean time, it is probably best to hold off on the PHP 7.3 upgrade until 7.68 is out the door, and also contributed modules have had a chance to upgrade and release a new stable release.
A simple search on Drupal.org yields the following modules that look like they may need work (more are certainly possible):
- composer_manager (issue)
- scald (issue) [now fixed and released]
- video (issue)
- search_api (issue) [now fixed and released]
Most of the issues seem to be related to this deprecation - Deprecate and remove continue targeting switch. If you know of any other modules that have issues, please let me know in the comments.
Drupal 6
For all you die hard Drupal 6 fans out there (I know a few large websites still running this), you are going to be in for a rough ride. There is a PHP 7 branch of the d6lts Github repo, so this is promising, however the last commit was September 2018, so this does not bode well for PHP 7.3 support. I also doubt contributed modules are going to be up to scratch (drupal.org does not even list D6 versions of modules anymore).
To test this theory, I audited the current 6.x-2.x branch of views
$ phpcs -p ~/projects/views --standard=PHPCompatibility --runtime-set testVersion 7.3
................................................W.W.WW.W.... 60 / 261 (23%)
................................E........................... 120 / 261 (46%)
...................................................EE....... 180 / 261 (69%)
............................................................ 240 / 261 (92%)
..................... 261 / 261 (100%)
3 errors in views alone. The errors are show stoppers too
Function split() is deprecated since PHP 5.3 and removed since PHP 7.0; Use preg_split() instead
If this is the state of one of the most popular modules for Drupal 7, then I doubt the lesser known modules will be any better.
If you are serious about supporting Drupal 6, it would pay to get in contact with My Drop Wizard, as they at least at providing support for people looking to adopt PHP 7.