Since PHP announced the release of 7.0, it created a lot of movement in the world of web development since it claims to perform 50% better as compared to previous versions. Prior to PHP 7, PHP 5.6 was a major and stable release widely supported by almost all the hosting providers. Later PHP 7 was released skipping the experimental version of PHP 6.
The main cause of such a huge performance gain is the change in the PHP engine. PHP 7 is using PHPNG(Next Generation) as it's core engine as compared to Zend Engine used by PHP 5.6. This change attracted lots of users since it's close to the performance of HHVM. In the end, Facebook finally closed further support of PHP on HHVM due to the amount of change in PHP 7.
The purpose of writing this post is to put some light on why we really need to worry about migrating PHP to at least 7.1. The official support to PHP versions is as listed below:
- PHP 5.6 - It won't receive any security and major updates after 31st Dec 2018. So we can say bye-bye at least to PHP 5.6 from Jan 2019 onwards.
- PHP 7.0 - Similar to PHP 5.6, it won't receive any major updates after 3rd Dec 2018.
- PHP 7.1 - It will receive security updates till 31st Dec 2019. This means it's fine to continue with it for another 1 year.
- PHP 7.2 - It will receive security updates till 30th Nov 2020. It seems a fair deal to upgrade to PHP 7.2 which seems promising for the next few years.
- PHP 7.3 - It will be released by mid of Dec 2018 and supported officially for next 3 years.
Why do we prefer to upgrade to at least PHP 7.1?
- PHP 7.1 brings a whole new set of features as compared to PHP 5.6. It will be a fair deal to migrate existing websites and applications if possible to this newer version of PHP.
- It will be easy to migrate to PHP 7.4, PHP 7.3 and PHP 7.2 from PHP 7.1.
- PHP 7.1 and later will receive official updates.
- In case someone finds security exploits, the sites running on PHP 5.6 might be compromised.
- The popular open source full-stack frameworks including Laravel and Yii requires PHP 7.1 in order to utilize full features.
- Each newer version of PHP 7.x is adding more promising features and helps in writing reliable and more robust code focusing on OOPS and typed variables, arguments, and returns.
- While writing this post, the most recent release of Ubuntu 18.04 LTS supports PHP 7.2.10 which seems fair enough to consider migrating to PHP 7.2. In case of PHP release a new version which is not supported by it officially, we are always open to using it using PHP FPM.
How can we upgrade to PHP 7.1 or later?
In case your site or application is running on PHP 5.6 or prior release, you must consult a professional developer or agency to analyze the compatibility with PHP 7.1. Some part of your website or application might be breaking due to the changes brought by PHP 7.1. You must also check whether your hosting provider provides support to PHP 7.1, else you might be required to switch hosting provider.
In case of WordPress or other CMS systems, you must first backup your existing site and database and then try to migrate the underlying platform instead of directly jumping to newer PHP. There might be dead plugins which do not receive any update from their authors and must be turned off before upgrading the underlying platform i.e. WordPress, Drupal etc.
Migrating from PHP 7.1 to PHP 7.2, PHP 7.3 won't bring any major inconsistency from website or application point of view. The newer versions are getting more strict on type safety and PHP 7.4 will officially support typed variables.