PHP 8: The importance of staying up-to-date with your websiteArchitecture
Puck, 28 September 2022
* Last updated 2 March 2021
For a while now, a new version of PHP has been available: PHP 8. Perhaps you have already heard a few things about this. You may even have received a message that your website runs on an outdated version of PHP.
Now many people ask the question “Why should I upgrade my website?”. In this article, we will briefly discuss the new features within PHP 8. We explain what you can take into account when upgrading to PHP 8 and most importantly, why it is important to always stay up-to-date.
You hear, read and see a lot about it: security is really important in webshops. You can compare it to doing your banking on a laptop running Windows 98… very unsafe. This may sound a bit exaggerated but if your website works with a PHP version that is no longer supported, you expose your website to dangers such as hacking that are easy to prevent by upgrading.
Staying up to date is obviously also positive for the performance of your website. Until now, every update of PHP has improved the performance. This of course depends on the type of website you have but in general upgrading usually results in a faster website. If your website is currently running on an outdated version of PHP it could be that the performance has decreased tremendously over the past years. This may be due to plug-ins that no longer work properly with an outdated version. These can then only be optimized for newer versions of PHP.
Finally, it is important to realize that as a website owner you have an accountability. The AVG (General Data Protection Regulation) states that you are responsible for demonstrating that your website complies with the privacy rules. This includes keeping software up to date. If your webshop runs on a PHP version that is no longer supported and this leads to data leakage, for example, this may have major consequences. In such a case, this could mean that you are directly responsible for compromising the security of sensitive data as a result of overdue maintenance on the website. This in turn means that you are not complying with the AVG guidelines. This often leads to fines: so pay close attention to this.
What’s new in PHP 8?
In this new version of PHP – which has been out since November 2020 – a number of things have changed. For example, new features have been added but also taken away. Below we list some of the benefits and useful new features that have been added to PHP 8.
- JIT Compiler: This feature improves the speed of loading PHP script one step further. This makes your website faster.
- JSON Support: Where previously JSON support was optional, it is now a core feature that is always available.
- Support for Attributes: Previously, this option was not supported. Programmers had to find their own alternative solutions to assign machine-readable metadata such as class to code. Now that this is a standard component, there is no need to come up with any alternative solutions.
One major change that might have a negative effect is that PHP 8 is a lot stricter about the code it receives. Where in 7.4 you got a warning, now you get an error notification. Another disadvantage is that there may still be existing plug-ins or programs within your website that are not yet fully compatible with the latest version of PHP. It is therefore important to pay attention to this when making the switch to avoid errors in your website.
Points of attention when upgrading to PHP 8
Since PHP 8 has changed a lot in the way code is read, it is important that your website and all plug-ins can handle this new version. But even if you prefer to wait until PHP 8 is definitely compatible with your website, it is still important to stay up-to-date.
Therefore, here are some points of attention where you can pay attention to when upgrading regardless of the CMS.
- Make regular backups of your site. This way you always have a fallback base, should something go wrong during the migration or upgrade of your website.
- Always check the results in a test environment before applying the change to the actual site.
- Make sure all plugins support the new version of PHP you are upgrading to. If this is not the case: Upgrade them first or look for alternatives that are compatible with the latest version PHP.
All in all, staying up-to-date is very important but for many it can feel like a big step. Do you need help migrating or updating your website or do you have any questions? Please contact us for advice and assistance.