PHP 7 with OpCache Now Available at Kualo
We're excited to announce that the latest PHP 7 Release Candidate is now available on our shared and reseller hosting, and also any cloud or dedicated servers which utilise our "Hive" PHP selector. PHP 7 is a big milestone in the development of PHP, and it provides significant improvements in performance over other PHP 5.x versions. In addition to performance increases, there are major changes including depreciated functions and new features. Although most commonly used applications such as WordPress and Drupal are already compatible, if you have any custom-written PHP code on your web site you or your developer may need to make changes to make it compatible; we'll provide some useful details and links later in this post. Given the performance increases, we'd strongly recommend that you ensure your site is compatible sooner rather than later.
What happened to PHP 6?You may be wondering why there is a jump from PHP 5.6 straight to PHP 7. Where did PHP 6 go? Well, there actually was a version of PHP called PHP 6, and development for it was under way as early as 2005. The project however encountered numerous problems with incorporating unicode without causing serious CPU overhead, and the project was officially abandoned. Since many details and even publications about PHP 6 had already been produced, it was decided that the next major release of PHP would be called PHP 7 to avoid confusion.
PHP 7 is faster than a speeding rocket!One of the most exciting benefits of PHP 7 is its performance improvements, and the gains that can be realised from simply switching to PHP 7 are huge. The performance gains are so significant that it is worth ensuring your web site is running on PHP 7 as it may mean that your site runs significantly faster, or, if you run a very large site perhaps on a cloud or dedicated server, that it requires less server overhead to run it.
PHP 7 is based on the PHPNG (PHP Next-Gen) Project, which was led by Zend to speed up PHP applications. PHPNG saw speed improvements of between 25% and 70% on real world apps, and since it was incorporated into PHP 7, its performance has more than doubled and will continue to improve as PHP 7 is further developed. To put things into perspective, when PHPNG was published, the WordPress homepage required approximately 9.4 billion CPU instructions to execute. As of now on PHP 7, it requires only 2.6 billion - a 72% improvement.
The following graphs show the performance benefits seen in the current release of PHP 7 for commonly used applications/frameworks.
[gallery columns="1" size="large" link="file" ids="1162,1126,1125,1124"]
As you can see, PHP 7 is significantly better at handling requests than PHP 5.6, and this translates into lower latency and faster load times for your application - and faster load times make for happier visitors and improved search engine optimisation.
PHP 7 - OpCache as StandardAnother key component of PHP 7 is that it uses opcode caching as standard. Without OpCache, when PHP code is run it is compiled into opcode and then executed. With OpCache, it is compiled and then the compiled version is stored on disk, so the next time it is run it can skip the compilation step. This means your site will load faster as each request by each visitor for doesn't have to be re-compiled.
We're storing the OpCache in your cPanel user folder, under:
The cache will refresh in the event a file change is made to the original PHP file, but by storing the cache directly in your home directory, you can also manually clear it at any time by simply deleting the folder or a specific page. It will then be automatically re-cached next time someone views your site.
PHP 7 and Backwards CompatibilityPHP 7 represents the biggest change in PHP technology since PHP 5.3. There are many changes that were made and some functions have been deprecated which may result in issues with your applications. Backwards compatibility with code written for previous versions of PHP is therefore not guaranteed. Most of the major applications and frameworks have already updated their code so that they are PHP 7 compatible, however if you have any custom written applications, you may need to make changes to the code to ensure that it is compatible with PHP 7.
The most significant changes are a new operator, <=>, aptly named the 'Spaceship Operator' due to it's appearance. It can be used for combined comparisons - mostly when dealing with sorting. Secondly, PHP 7 allows developers to define what kind of return type a function is expected to have, whether it be a string, float, int or boolean. If you've got any custom written code that you need to adapt for PHP 7, we'd recommend reviewing the following article from Zend for a bit more information about backward compatibility issues. Another good introduction is found in a