Powered by pantheon.upstream.yml
It’s been almost a year since we made PHP 7 available for all sites on Pantheon. It’s not only 62% faster than PHP 5.6, but now it’s also the recommended default for WordPress and fully tested with Drupal 8. The time is ripe to make it the default for all new WordPress and Drupal 8 sites, and today we’re happy to announce that all new Drupal 8 and WordPress sites on the platform default to PHP 7!
The change also applies to existing Wordpress and Drupal 8 sites (while Drupal 7 now defaults to PHP 5.6). Just apply the one-click upstream update from your site dashboard. This change is deployed along with your code, so you have the opportunity to test prior to launch. Apply the selected PHP version to the Test or Live environment by deploying code to that environment.
Overriding PHP Version at the Site Level
PHP 7 should work well for most sites, although in some rare cases, you may encounter issues. If the update to PHP 7 causes any issues, select a different PHP version by adding a pantheon.yml file to the root of your site’s repository. The contents of this file should be as follows:
When this file is committed and pushed back to Pantheon, it overrides the default version of PHP provided by the upstream. If you have any sites that break with the latest versions of PHP due to incompatible contrib modules or plugins, you can use this technique to limit the PHP version to something that works. Later, when all incompatibilities have been taken care of, remove the php_version directive from your pantheon.yml file to allow your site’s PHP version to be updated when a newer version is provided in the upstream.
As always, more info on changing PHP versions can be found in our docs.
Managing Custom Upstreams
If you have sites that were created from a custom upstream, they will not get the PHP version updates that sites based on the Pantheon standard upstreams do. In this instance, you will probably want to specify a default PHP version in a file named pantheon.upstream.yml in the upstream repository. Note that the filename is different, although the structure is much the same:
# IMPORTANT NOTE:
# Do not edit this file unless you are doing so in your custom upstream repository.
# Override the defaults specified here in a site-specific `pantheon.yml` file.
# For more information see: https://pantheon.io/docs/pantheon-upstream-yml
For a complete example, including a suggested change to .gitignore see https://github.com/pantheon-systems/drops-8/pull/189/files. If you add this to your upstream, then all of the sites created from it will inherit the php_version setting the next time they are updated from their dashboard.
Now that you know what to expect, go ahead and open up your Pantheon dashboard, click the “Apply Updates” button, and give PHP 7 a spin on your sites. The performance improvements are sure to please!
As always, more information on changing PHP versions can be found in our documentation: