PHP 7 for WordPress: even faster than before!
by: Alexander van Steen
At Savvii we value fast loading websites. We are always searching for existing and new technologies to improve the loadtimes for our customers. Have we got some good news for you: we have made a new technology available for you….PHP 7 for WordPress. Now your
Maybe you are thinking ‘That took you guys a while’, but there is a reason for that. As a premium WordPress host we only want to offer stable software to our customers. PHP 7 has a stable version out since december 2015. Using stable software means that the growing pains and security issues affecting all new software have been fixed. In addition to this, we had to put some work in to make it possible to switch PHP versions per site because some websites will not be compatible with PHP 7. And guess what…now you can!
The advantages of PHP 7 for WordPress
PHP 7 is the latest version after PHP 5.6. Don’t ask us why they skipped PHP 6 (there are a lot of interesting theories about this topic floating around on the internet), but let’s assume it was to highlight the fact that it is a big upgrade. The branch of PHPNG (PHP Next Generation) was finally merged in PHP 7. PHPNG is the core of PHP and replaces Zend Engine 2 which was used in PHP 5.x. PHPNG has been tailored for more efficient memory use and performance, in short: faster loadtimes.
But the question is, how much faster is PHP 7 for WordPress websites? The answer is ‘a lot’. Many benchmarks have been performed on running PHP 7 for a vanilla WordPress site. The results show that PHP 7 is roughly 2-3 times faster than PHP 5.6 and in some cases even faster than HHVM (a popular alternative for PHP).
WordPress 4.4 benchmark for the frontpage – Source: http://www.jeffgeerling.com
In addition to an increased performance there are more advantages to using PHP 7. Exception handling on errors has been greatly improved, as is the use of namespaces. It is now also possible to use anonymous classes. PHP 7.1 comes with even better performance.
Mainly for performance reasons ofcourse. Small sidenote: PHP 7 is faster in handling PHP code, a cached page in Varnish will keep the same loadtimes as before. The same goes for pages or objects stored in memcached or on disk. The improved performance will have the biggest impact for uncached pages such as pages in your wp-admin or when page caching is not possible due to use of sessions.
A second reason to switch is the perspective. The PHP team will only support 5.6 until the 31st of december 2016. PHP 7 is the new long-term supported version.
What are the risks?
PHP 7 is relatively new. The official stable release is from the 3rd of december 2015. The WordPress core team has tested all commits against PHP 7 and WordPress core itself has stable performance. However, there is some risk when using themes and plugins. Some of those may use deprecated functions and will not function on PHP 7. It is always possible to fall back on PHP 5.6 at Savvii for the time being.
We advise to test your websites on PHP 7 in, for example, a Vagrant box running PHP 7 before switching on PHP 7 for your production websites.
How can I use PHP 7 for WordPress?
All new sites at Savvii are currently being provisioned with PHP 5.6. This is purely due to compatibility risks with old themes and plugins.
We offer PHP 7 as an option for all customers and websites. Have you decided on upgrading to PHP 7, you can find that option in our Control Panel, it can take up to 5 minutes to take effect. In case it breaks your site you can switch back to PHP 5.6.
Our own Savvii websites are running PHP 7 for a few weeks now and we are very happy with it.