How to Update PHP to Protect Your Website Against PHP2Shell
PHP released emergency updates — versions 8.5.12, 8.4.27, 8.3.36 and 8.2.35 — on 21 October 2026 to fix two serious remote code execution flaws. Here is how to check and update.
On 21 October 2026, the PHP team released emergency updates to fix two serious flaws that could allow remote code execution. The patched versions were PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. If your website runs on PHP, which includes most WordPress sites, this is the kind of update you should not postpone. A flaw in the PHP engine itself can affect every site on the server, no matter how careful you are with plugins.
Why updating PHP matters
PHP handles form data, database queries, logins and most of the dynamic work on a website. A bug in that layer can let an attacker run code on the server, read sensitive data, change website files, plant malware or create a backdoor. New PHP releases also bring speed and memory improvements, and older versions eventually stop receiving security fixes altogether. Staying current is one of the cheapest security habits a site owner can have.
Step 1: Check which PHP version you are running
There are three easy ways to check. Over SSH, run php -v on the server. In WordPress, go to Tools, then Site Health, then Info, and look for the Server section. Or create a small file called info.php containing the phpinfo function, open it in a browser, then delete it immediately afterwards, because leaving it public exposes server details.
Step 2: Update PHP
On Ubuntu or Debian, update your package lists and install the new PHP packages from your usual repository, then restart your web server and PHP process manager so the new version takes effect. On DirectAdmin or a similar hosting panel, look for the PHP version selector, choose the latest patched version for your branch, and apply it. On shared hosting, the PHP version is usually a setting in the control panel, and your host can help if the option is not visible.
Step 3: Test your site after the update
- Visit the homepage and a few key pages, including login, checkout or contact forms.
- Check the site error log for warnings about functions that changed or were removed.
- Confirm that plugins and themes still work. Very old code sometimes breaks on new PHP versions.
- If something breaks, roll back to the previous version temporarily, update the broken plugin or theme, and try again.
The safest order is: back up the site, check the version, update to the patched release, and test. Do it on a staging copy first if your site earns money or handles customer data. A few minutes of testing is far cheaper than cleaning up a hacked server.
Comments (0)