After a long and winding road, PHP 7 is finally here. You’ve probably seen the headlines, “2X the Speed, 1/2 the Ram!” and every variation you can imagine. We’re jumping on the bandwagon here at Envisage and have started to deploy PHP 7 to our development testing servers in anticipation for a complete roll-out to our production machines this fall.
Can we run it?
After a bit of back and forth with checking extension compatibility and updating some legacy code to resolve issues with fully deprecated extensions, we finally had a running server.
We’ve been able to benchmark the speed of our newest site, www.ESLDirectory.com, and the results are promising. Indeed, the amount of ram needed to process each page is roughly half of the previous version and the speed was twice as fast.
How is the magic possible? Is there really such a thing as free performance? It appears so! We updated our repo sources to a reputable one and pulled down the latest packages. After updating the FPM config to point to new back-end PHP binary and doing some minor configuration adjustments, we started our suite of functional tests and the results are as promised.
It’s the insides that count
By focusing on the core of PHP and changing how internal structures operate, they’ve made the hashtables more efficient and the data structures themselves smaller, resulting in less memory and faster operation.
OPCache cache cache
Another new trick in PHP 7 is a secondary persistent, file-based cache to the standard OPCache that uses shared memory. Basically giving you a second shot at serving up compiled OPCode before resorting to loading it from the file system. On a server that’s reloaded often, a persistent OPCache will help speed up the processing as the shared memory space cache is primed.
JIT totally not vaporware
Another great reason to upgrade now is the promise of a JIT compiler that could appear in version 7.1 or 7.2. That could boost performance even higher and help strengthen the reputation of PHP as a top-tier language for the web’s future. I will remain optimistic that it will be here sooner rather than later and we’ll see even more performance improvements.
To say we’re excited is an understatement. The usual pattern for upgrading anything is first accommodating the new hardware requirements, which have always been higher than the previous version. This update breaks the mold and gives you more for less.