Table of contents of the article:
WordPress is primarily written on the PHP scripting language and is undoubtedly one of the parts that have the greatest impact on all existing WordPress sites. The main parts of not only the backend but also the front end of the WordPress interface and page exist due to PHP, plus of course all plugins and themes.
It also offers us the ability to do so much when it comes to creating a website, as we not only find it in the page templates and plugins, but, in addition to that, it makes up all the files that make up the WordPress dashboard. . In short, without PHP your website wouldn't even exist. This post is about understanding and fixing the outdated PHP version warning in WordPress
Something that all WordPress users need to know about PHP is the huge effect it has on the security and performance of their websites. This server side scripting language has progressively improved over time and continues to go in the right direction with each consecutive update. A new version of PHP comes out on the market almost once a year. For each branch version of the language, there is constant support for two full years. The third year would only get the absolutely critical security updates; therefore, your PHP version is not part of those tasks that you can set up once and then forget about it.
A huge problem that the WordPress community is facing is the fact that many sites, companies, developers and hosting providers do not support latest versions of the scripting language. It is particularly frustrating when we consider how quick and easy it is we can update it.
The lifespan of previous PHP versions is running out for your WordPress
As of September 14, 2022, the latest version of PHP is 8.1. It is also arguably the largest to date. Versions 5.5, 5.6 and even 7.0 have now reached the EOL (End of Life) state. It is a standard part of every PHP release cycle. Once a given version reaches its EOL, PHP would drop the security support provisions for it.
If you are wondering: "Hasn't PHP 8.0 just been released ?!”- it was 1 year and 9 months ago. And to be exact, PHP 8.1 only started receiving security updates from the beginning of December 2021. Active support for PHP 7.4 was discontinued even before the end date for security support of ver. 7. Additionally, security support for 7.4 will end soon ie early December 2022.
According to official WordPress.org stats page At the time of this article's publication, only about 56% of users have already upgraded to a supported PHP version. A very small amount (7%) use PHP 8, and only 1% actually use the newly released version 8.1 of the scripting language. What we can see is the fact that most users - over 34% - continue to run on PHP 7.3, PHP 7.2 and 7.1. What's even scarier is that about half of WordPress users are using outdated and unsupported versions of PHP.
Why does WordPress require newer versions of PHP?
In December 2018, at WordCamp US, a highly anticipated punch in the minimum requirement for the PHP version on a WordPress site was announced. Matt Mullenweg suggested during his State of the Word 2019 that 5.6 was the minimum version until mid-2019 and that it be upgraded to PHP 7.0 again in the second half of the year. All of this will be a fact in case nothing goes wrong. This claim was hugely applauded - it received far more praise than previous Gutenberg news reports.
However, the announcement by the WordPress team it was a big surprise to the entire WordPress community. Of course, continuing with the latest versions of PHP is welcome news, even if the minimum PHP version required to run a WordPress-based site hasn't been touched for years. All these changes were long overdue and then became de facto standards.
The WordPress Core Team is responsible for managing the most used CMSs in the world. That said, they have made a commitment to make sure WordPress keeps pace with PHP over the next few years and works to raise awareness, along with changing apathy, awareness, or support for newer PHP versions.
“The immediate goal is to put in place the support structure and education / resources of the site owner, etc. In order to be able to more actively reduce the number of active WordPress sites existing on previous versions of PHP EOL and thus improve the security and performance of the web ”.
The current plan provides for a warning to be displayed in the back-end administrator panel for sites using PHP versions older than the supported PHP branch (in this case, for example, earlier than 7.4) The "warning" message would contain a link to one of the WordPress support pages which briefly explains the problem, followed by a dive into how all site owners can be ready for an upgrade to their server's underlying PHP version and then run it.
Those alerts started showing up as notification messages starting with WordPress 5.1, which was released some time ago around March 2019.
Sites that choose to stay on PHP 7.3 or lower will still be able to receive security updates and perhaps some bug fixes, but will not have the opportunity to use the most updated and major version of WordPress until they go through the process of updating their own. PHP.
Prior to the much anticipated release of WordPress 6.0, it was stated that the CMS aims to fully support PHP version 8 in its release. Currently, the official requirements page suggests that to run WordPress, your host must support 7.4 or later.
However, there is the official note which states:
Even as WordPress Core continues to expand its support for new PHP versions, there is no intention of dropping support for older versions until usage numbers show that the impact on users will be minimal.
The story behind the outdated PHP Version Warning Warning feature.
It all stems from the update statistics compiled days after WordPress version 5.0 had reported that around 85% of users were already managing their websites with PHP 5.6 or later. This shows that a small part of the active community takes note of these warnings in general.
The core WordPress team has had comments on specific notifications with the role of encouraging users globally to update their PHP versions and such notifications have proved extremely effective. With the release of Yoast SEO 4.5 in early 2017, their team experimented with using a similar alert approach . Yoast added a notice urging site owners with out-of-date PHP versions to update it. The only way to disable this warning was to proceed with the update. The results showed that the updates got double the rate than before the notification appeared.
We have seen this notice had a big impact and now we have less than half of PHP 5.2 users who have the WP core. As annoying as it is, it works. That's why I wouldn't bet that the core team does anything other than what we do.
- Joost de Valk, founder and CPO of Yoast
This initiative has been called the Yoast WHIP project and demonstrates that the "nuisance" (as de Valk calls it, in the original Trac ticket they wrote about merging WHIP into the WordPress core) users to upgrade could actually lead to a change which makes everything better for everyone.
As a result of the WHIP project, along with the positive increase in the number of PHP updates, the Servehappy project.
Why can't you just use an old version of PHP forever?
One of the most important reasons to upgrade your PHP version is the security. Your WordPress will be much more secure if it is running one of the latest versions of the scripting language. It will ensure that your company is protected from the most current vulnerabilities on the "market" and will also be regularly patched for security holes, as well as major improvements in terms of execution speed and performance.
Among the different reasons for preferring an updated version:
- PHP 8 has already demonstrated much higher data processing and load capacity compared to its predecessors. In addition to the high performance, you are likely to expect huge memory savings. The reason is that substantial optimization has been made in the internal data structures.
- Official PHP benchmarks show us that PHP 8 allows the system to perform twice as many requests per second compared to PHP 5.6 and as much as 50% compared to 7.4 at almost half the latency.
- From a business perspective, PHP 8 offers crystal clear advantages over its predecessors, such as excellent performance, resilience and use. It is able to enjoy a modest advantage when it comes to WP.
- Companies, like some e-commerce giants, with a large online presence they would find PHP 8 particularly suitable for their website.
- The minimum requirements for WordPress have increased.
- Ultimately, users will have compatibility issues with incompatible plugins and scripts installed with their outdated version.
- Last but not least, probably the best practice is to approve a stable version. All new features promote the upgrade.
How to update PHP safely
We hope by now we have convinced you that updating your PHP version is absolutely necessary if you want the best performance and maximum security of your website. The migration is not that complicated as long as you proceed safely, in order to ensure that the update does not break any of the elements of your site.
Whenever we consider moving to a new version, the thing that is taken into consideration is compatibility. Note that PHP 7 is not compatible with previous versions. The main thing to keep in mind is the fact that if you haven't been diligent in maintaining your WordPress software, some scripts, plugins, or themes may not be compatible with specific versions of PHP you want to use. Also, they may not work as expected. Furthermore, a wrong version of PHP could damage your site in whole or in part. Of course, it is possible that the plugin or theme code is completely dependent on the previous version. Ultimately, we can always try the upgrade and downgrade in case of problems.
Step 1: Keep calm and always create backups before updating
Most likely, when we update PHP, it's all plain sailing. However, there is never any guarantee that everything will go according to our game plan. In case a problem occurs, we want and need to have a backup and reassemble the website. This is all a lot easier if you already have a clean and brilliant backup of your site.
Regular backup of your website is already something we do for free, along with our services. However, we recommend that you have a new backup of your site handy by your side, so that you can easily roll back your changes in case something goes even slightly wrong.
We encourage everyone to manually generate a backup before pulling the trigger and updating their live websites.
Step 2: Create a local staging copy of your website
It is always the best idea to test the latest PHP version in a staging or development environment rather than on your live site. This staging website will act as a duplicate copy of your existing live website, placed in a subfolder of the root directory. Just keep in mind that once you create a staging site like that, it will automatically set that copy to be the same PHP version as your live site.
Then you should change the desired PHP version per directory. You can easily achieve this by setting up custom rules for each folder.
You can then go ahead and run tests on the staging site to assess the compatibility of your current themes and plugins and find out how it reacts. Be sure to check the error log for any errors. If nothing unusual happens, you can proceed with updating your live site later.
Step 3: Update everything
Before we get started, we need to make sure your plugins and everything else are up to date. In this way, we would check compatibility with the latest versions of everything, thus obtaining the best chance of success in our mission.
That way, you no longer have to wander around to fix things. Make sure you click the button that says "Update" wherever it is needed.
- Update WordPress itself
- Update your theme
- Update all plugins
Step 4: Check for compatibility
Now comes the part where you check for errors on your part. The things you are looking for and what you may be able to find can vary greatly. It all depends on the unique configuration you have. However, here is our recommendation for the order in which you test:
- Work your way through each page of the site and look for items that stopped working all of a sudden.
- Check all plugins one by one and see if they perform as they should.
- Test the features that include your active themes. Make sure everything is still working properly.
- Also, go to
wp-config.phpfile: set the variable
true. It would display all errors and warnings.
define ('WP_DEBUG', true);
Step 5: Update your live site
Once the testing phase is complete, follow the steps to proceed with the update.
Which version should I upgrade to?
We can't stress enough how highly recommended updating to the latest version of PHP is if your site's software can do it without a problem. The latest version needs to be supported the longest and is also the one with the most fixes that improve a website's overall performance.
And if something doesn't work after the update, what should I do?
Here we enter a complex area in which we are going to make some technical considerations on what we have written so far, which is basically what the international community narrates, made up of developers who perhaps have had little to do with systems engineering. .
First of all, the above is valid, that is, when you can update the PHP interpreter you have to update the PHP interpreter, there are no reasons such as laziness and indefinite procrastination.
However, it is not always possible to update the PHP interpreter to the latest version for reasons of compatibility, deprecated functions, plugins no longer supported, miscellaneous and any.
We have customers who still run on PHP 5.3, core-level customized versions of WordPress 3.5, science fiction stuff to be clear that nevertheless work well, bring profits and profits and cannot be updated except with grueling work and an investment of tens of thousands. of Euro.
In this case the advice is always to update to the most recent upgradeable version.
Do we have PHP running on version 5.2 or 5.3? We can't bring it to 8, we can't bring it to 7, but let's at least try to bring it to the latest release of branch 5, or 5.6 and if everything works let it run with that version, in the meantime we try to correct the code problems to upgrade to a recent version, possibly the latest.
In these situations, attention must necessarily be focused on aspects such as security, backup and disaster recovery.