Here at Phoenix we’re in the middle of upgrading our websites to use PHP7 instead of PHP5.6. PHP5 has been the world’s most popular server scripting language for almost a decade now. The time has come to put the faithful old workhorse to pasture. Our website is already using PHP7 and reaping the benefits.
PHP7 introduces several new programming features, but the single greatest feature of PHP7 is its awesome performance improvements. In tests it executes its code 2-3x faster than PHP5. That doesn’t mean your website will load 2-3x faster, as there are many other activities that take place to put a web page in front of your eyes, but you will get a significant boost. I did an analysis of our website’s loading times comparing the server running PHP5.6 and then running PHP7.0. I used pingdom tools to get loading times. I also took a look at server waiting times using Google’s HAR Analyser to obtain the times from the pingdom tests. I turned off all PHP caching and WordPress caching plugins before running the tests. The results are as follows:
Test Number | pingdom.com Load Time (s) | HAR Wait Time (s) | ||
---|---|---|---|---|
pingdom.com PHP 5.6 | pingdom.com PHP 7.0 | HAR Wait Time PHP 5.6 | HAR Wait Time PHP 7.0 | |
1 | 5.71 | 3.25 | 6.75 | 5.93 |
2 | 7.51 | 2.81 | 25.17 | 4.03 |
3 | 2.04 | 5.40 | 3.63 | 6.41 |
4 | 5.00 | 2.61 | 9.81 | 3.73 |
5 | 3.19 | 2.60 | 7.34 | 5.16 |
6 | 3.55 | 4.21 | 10.04 | 5.95 |
7 | 2.85 | 2.58 | 5.91 | 5.68 |
8 | 6.82 | 2.95 | 12.48 | 4.45 |
9 | 4.78 | 3.53 | 14.26 | 5.77 |
10 | 3.60 | 7.00 | 6.37 | 19.01 |
11 | 2.48 | 4.98 | 4.31 | 10.32 |
12 | 2.86 | 3.08 | 4.23 | 5.27 |
13 | 4.69 | 2.43 | 6.77 | 5.59 |
14 | 2.84 | 2.65 | 3.82 | 4.23 |
15 | 7.86 | 2.48 | 23.55 | 4.08 |
AVERAGE | 4.39 | 3.50 | 9.63 | 6.38 |
Going by the pingdom tools load times that is a 25% smaller average loading time upgrading from PHP5.6 to PHP7.0. Not too shabby. Going by the average server wait time, the saving is 33.7%. Apparently 7.0 also uses less memory than 5.6 but I didn’t test that. If you’re interested, HAR files for the tests are downloadable right here.
phoenix-web-development-php7-0-speed-test-hars
The first public release of PHP7 was in November 2015, almost a year at time of writing. We’ve waited until now to implement it because many WordPress plugin developers hadn’t updated their code to handle PHP7. PHP7 removes all deprecated functionality of PHP5 and makes some other backward incompatible changes. The result is that upgrading to PHP7 is only safe when the code has been prepared for it. The core WordPress development team made sure WordPress was compatible with PHP7 on the day of release. All the major WordPress plugins are now compatible with PHP7. At this stage a plugin which breaks with PHP7 is probably not worth using.
Incidentally, if you’re wondering what happened to PHP6, it does exist but it never left the experimental stage. PHP6 was an attempt to integrate unicode support into the language and was something of a failure. Development was abandoned in 2010. You can read more about PHP6 here.
If your web developer hasn’t yet transferred your website to PHP7 give them a nudge. There are plenty of upsides and no downsides to upgrading and the time has come.
Leave a reply