Speed Difference in WordPress: PHP 5 vs PHP 7

There’s been a lot of talk about upgrading to PHP 7 especially in the WordPress community. Yoast SEO, a WordPress plugin, recently added a non-dismissible notification urging users who use old versions of PHP 5 to upgrade to PHP 7.

I’ve upgraded my server to PHP 7 and although it initially produced some warnings due to some theme and plugin code being written specifically for older PHP version, I’ve modified those and there have been no hiccups since then.

Speed Difference PHP 5 and PHP 7
PHP 7.1 Shows faster execution time and lower memory usage.
PHP Time (ms) Memory (bytes)
5.3 1894.33 45,231,136
5.6 1468.88 24,725,168
7.0 887.32 26,929,832
7.1 847.85 26,694,560

The image above shows PHP 7.1 being twice as fast as PHP 5.3 when loading a single post page. Also notice the decrease in memory usage.

There are WordPress-powered websites that don’t use page caching especially if their site contains a lot of dynamic content. In cases like those, upgrading would make a lot of difference. This speed difference might not be noticeable if you’re using a page caching plugin, but still, every saved resource counts.

Leave a Reply

Please write your comments in english. I delete anything that even remotely resembles spam.

Note: When posting code, enclose it in pre and code tags.
e.g. <pre><code> Add code here </code></pre>