As any technology reaches the end of its life, there tends to be a group of users who wait as long as possible to switch to a new one. In the case of an important language like PHP, the end of security support for version 5 is a significant event, and website administrators need to aware of and address any issues or migrations by the end of the year.
PHP is a programming language which is usually used for server-side scripting and is frequently used as part of the LAMP architecture for deploying web applications. The first thing you need to know is that PHP is used by 79% of all websites with known server-side programming languages, so if you are not sure, yours probably uses it too. Among those sites, nearly 79% are currently using a branch from version 5, so if you have yet to move to PHP 7, you are hardly alone. Millions of websites are going to have to migrate to the newer version in the next few months, as security support runs out for PHP 7.0 on December 3, and for PHP 5.6 on December 31, 2018.
Branch 5.6 is the last PHP Version 5 release, and in order to give websites more time to move to PHP 7, its active support was extended by four months, and its security fix period by an entire year. When that period runs out, no further releases will be issued to patch security vulnerabilities. At PHP.net, the PHP Group, which produces the language’s reference implementation, warns users that “using older versions may expose you to security vulnerabilities and bugs that have been fixed in more recent versions of PHP.”
This means that a change is necessary for every website running PHP 5.6, which likely includes yours.
There are a few things you should know about making that change and what it will be. With a small amount of preparation, potentially major headaches associated with the change can be avoided.
What You Should Know
The end-of-life of PHP 5 is part of the normal release cycle for the language. Each version is actively supported for two years from the date of its first stable release, with regular releases addressing any known bugs and security vulnerabilities. Two years after its release, each version is supported only with fixes for critical security issues as needed.
Because it has not been actively supported, any non-critical PHP 5.6 bugs and performance issues that have cropped up have not been addressed with new releases. Meanwhile, more than four years have passed since version 5.6 was released, and the community has worked to improve the language. The continued popularity of version 5.6 shows that it continues to work effectively enough for most of the web, but branch 7 delivers a number of new capabilities and a powerful new Zend execution engine.
The active support period for PHP 7.1 actually ends even before the PHP 5.6 security support end date, and the security support period ends on December 31, 2019, so all servers will need to run PHP 7.2 or later in just over a year.
Migrating from version 5.6 to branch 7 is not just a matter of downloading the source code and copying it over the old version. PHP.net warns that between incompatibilities and new features, the code should be tested before switching version in production environments. This is always the case with new versions of PHP, but part of the goal of branch 7 was to deprecate legacy functions and remove dead or unsupported Server APIs and extensions, so many sites will encounter compatibility issues to work around.
An important thing to know about PHP 7 is that it is not backward compatible. That means testing needs to be done ahead of time to ensure all the different parts of your site will work when you have migrated.
If you are performing the migration yourself, what you need to know to begin is which version of PHP is running on all of the different components of your site and whether they will run on the new version. This usually includes a content management system (CMS), along with all of the themes, extensions, and plugins that make it unique. Most modern CMSs are compatible with many versions of PHP, and unless they are running older unsupported plugins or themes, these should be unaffected by the update.
WordPress, for instance, supports every version of PHP since version 5.2.4. There are tools available to help check for PHP compatibility, including some for specific CMSs.
Learn more about how to migrate from PHP 5.6 to 7.
What to Prepare For
The level of preparation necessary for a website operator migrating from PHP 5.6 to PHP 7 depends on the kind of website and hosting, but at the very least, it is necessary to prepare for the change to be made in time to work out any issues arising from the update and put it into production for the version 5.6 end-of-life date. If you are not sure if all of your plugins or themes are compatible, find out now.
To prepare for the switch, you will have to finally replace or stop using any of the deprecated items that have been removed, such as ASP-style tags and the MySQL extension. PHP 7 uses a new uniform left-to-right variable syntax, and also treats multiple “default clauses differently, both of which may require some tidying up in existing code. Making the necessary changes to your code, substituting or updating plugins and other website elements as necessary, and testing your site are the main steps to prepare for migration.
Once you have migrated, you can expect the newer version to deliver some performance benefits. PHP tends to get faster with each new release. In a recent benchmark by Phoronix, version 7.3 was roughly 7 percent faster than PHP 7.2, and 25 percent faster than PHP 7.0. The PHP 7 is significantly more efficient than PHP 5.6, and in certain situations can be nearly twice as fast.
The end of security support makes it critical to upgrade. The increased urgency is due to the possibility of vulnerabilities being found and exploited by hackers. Unsupported legacy elements of a system are attractive to hackers as low-hanging fruit.
If you know that the change is coming, and how different parts of your site will be affected, upgrading to PHP 7 is likely to be a smooth process involving little or no downtime.
While it will mean that some legacy site features will have to be replaced or eliminated, it will run all of the most important features of your website faster and more efficiently than before.
Most importantly, potentially critical security vulnerabilities will crop up in version 5.6, sooner or later, now that it has reached its end-of-life. Migrating to PHP 7 avoids them, and keeps your business online.