PHP Website Security: What to Check Before PHP 8.2 Loses Support
A PHP security checklist for business websites: supported versions and end-of-life dates, plugin risk, server settings and the code fixes that matter.
Key takeaways
- PHP 8.2 stops receiving security fixes on 31 December 2026; anything older, including 8.1 and every 7.x release, is already unsupported.
- W3Techs counts PHP on 69.2% of websites with a known server-side language, and 34.5% of those PHP sites still run version 7 or older.
- In the WordPress ecosystem, 91% of the 11,334 vulnerabilities found in 2025 were in plugins, and heavily targeted ones were exploited a median of 5 hours after disclosure.
- CVE-2024-4577 hit PHP-CGI on Windows with Japanese and Chinese code pages and was used against organizations in Japan from January 2025.
Is PHP secure enough for a business website?
PHP is still the default language of the web. W3Techs, in data dated October 2026, finds PHP on 69.2% of websites whose server-side language it can identify. That reach includes WordPress, most shared hosting, and a large share of older custom business systems. The language itself is actively maintained: each release branch gets two years of active support and then two years of security fixes.
So the useful question is not whether PHP is secure, but whether your particular site is running supported versions, maintained plugins and safe code. The same W3Techs data shows 26.8% of PHP sites on version 7 and 7.7% on version 5, none of which receive security fixes. That is where most of the risk sits.
PHP end-of-life dates: which versions still get security fixes
The PHP project publishes its support schedule on php.net. Once a branch reaches end of life, the project says users should upgrade as soon as possible because they may be exposed to unpatched security vulnerabilities. As of October 2026, four branches are supported.
The date that matters most right now is 31 December 2026. If your site or hosting plan is on PHP 8.2, you have about two months to test and move to 8.3 or newer. Moving straight to 8.4 or 8.5 buys more time before the next upgrade.
- PHP 8.2: security fixes until 31 December 2026.
- PHP 8.3: active support ended 31 December 2025; security fixes until 31 December 2027.
- PHP 8.4: active support until 31 December 2026; security fixes until 31 December 2028.
- PHP 8.5 (released 20 November 2025): active support until 31 December 2027; security fixes until 31 December 2029.
- PHP 8.1, 8.0, every 7.x and every 5.x release: end of life, no security fixes.
Plugins, not PHP itself, are the biggest risk
Patchstack's State of WordPress Security in 2026 report counted 11,334 new vulnerabilities in the WordPress ecosystem in 2025, 42% more than in 2024. Of those, 91% were in plugins and 9% in themes; WordPress core had only 6, all low priority. Patchstack judged 4,124 of them, or 36%, to be a real threat.
Two figures from the same report change how updates should be handled. For heavily targeted vulnerabilities, the weighted median time to first exploit was 5 hours, and 46% of vulnerabilities had no fix from the developer by the time they were disclosed. A monthly update routine is too slow for the first problem and does nothing for the second. The same logic applies to Composer packages in a custom PHP application: every dependency is code you are responsible for.
- Remove plugins and packages you do not use; deactivated plugins can still be reachable.
- Turn on automatic security updates for plugins where your testing process allows it.
- Subscribe to a vulnerability feed for the plugins and packages you run, so an unpatched disclosure reaches you the same day.
- Run composer audit in your build pipeline for custom PHP applications.
CVE-2024-4577: why Japanese Windows servers were targeted
CVE-2024-4577 shows how configuration and locale can matter as much as the PHP version. The official PHP advisory describes an argument injection in PHP-CGI on Windows that lets a remote attacker run arbitrary code. It works through Windows "Best-Fit" character mapping on code pages 932, 936 and 950, the system locales used in Japan, China, Hong Kong, Macao, Singapore and Taiwan. The advisory notes that a default XAMPP installation on Windows was vulnerable out of the box. The fixes shipped in PHP 8.3.8, 8.2.20 and 8.1.29.
Cisco Talos reported in March 2025 that an attacker had been exploiting this flaw since as early as January 2025 against organizations predominantly in Japan, in technology, telecommunications, entertainment, education and e-commerce. For a Japanese company, or a Canadian company with a server set up by a Japanese team, the practical checks are simple: do not run PHP as CGI on Windows, do not use XAMPP or similar development bundles in production, and confirm the exact patch version rather than only the minor version.
PHP security best practices in the code
The OWASP Top 10:2025 lists Broken Access Control first, followed by Security Misconfiguration, Software Supply Chain Failures, Cryptographic Failures and Injection. Most of these map to a small number of habits in PHP code. When we review a PHP codebase, these are the first things we check.
- Access control: check the user's permission on the server for every request that reads or changes data, not only by hiding links in the page.
- Injection: use PDO or mysqli prepared statements for every query; never build SQL by joining strings with request data.
- Cross-site scripting: escape output for its context, for example htmlspecialchars() for HTML, or use a template engine that escapes by default.
- Passwords: store them with password_hash() and check them with password_verify(); never use md5() or sha1() for passwords.
- Sessions and forms: set session cookies to HttpOnly, Secure and SameSite, regenerate the session ID after login, and add CSRF tokens to forms that change data.
- File uploads: check type and size on the server, store uploads outside the web root, and never let an uploaded file be executed as PHP.
Server configuration checklist for PHP websites
Security Misconfiguration is second in the OWASP Top 10:2025, and on PHP sites it usually means settings left as they were during development. These checks take an afternoon and do not require code changes.
- Set display_errors to Off in production and send errors to a log instead, so stack traces and file paths are not shown to visitors.
- Turn off expose_php so the PHP version is not advertised in response headers.
- Remove phpinfo() pages, installers, backups and .env files from the public directory.
- Run PHP through PHP-FPM rather than CGI, with the web server account limited to the files it needs to write.
- Serve the whole site over HTTPS and protect admin areas with multi-factor authentication.
- Keep encrypted backups off the server, and test a restore at least once.
A PHP security review you can run this week
If you own a PHP site but do not maintain it yourself, you do not need to read code to find the biggest risks. Ask your developer or hosting provider these questions, in this order. The order follows the evidence above: unsupported versions and third-party components are where compromises most often start, so they come before code review.
Write the answers down with a date. A review only helps if someone repeats it, and the written answers become the baseline for the next one.
- Which exact PHP version does production run, and when does that branch stop receiving security fixes?
- Which plugins, themes or Composer packages are installed, and which have had no release in the past year?
- How quickly are security updates applied, and who is alerted when a vulnerability is disclosed with no fix?
- Is PHP running as CGI on Windows anywhere, including old internal tools?
- Are admin logins protected by multi-factor authentication, and when was a backup last restored successfully?
Upgrade, harden or rebuild: deciding what to do with an old PHP site
For a site on PHP 8.2 or 8.3 with maintained plugins, upgrading is usually a matter of testing on a staging copy and switching the version in the hosting panel. Plan for a few days of work, most of it testing forms, checkout and admin screens.
For a site on PHP 7 or 5, the version change is rarely the hard part. The real cost is plugins or libraries that have no compatible release, and custom code that relies on removed functions. If more than a few key components are abandoned, compare the cost of patching with a rebuild on a maintained stack. Either way, put the end-of-life date for your current PHP branch in the same calendar as your domain and certificate renewals, so the next deadline is not a surprise.
About the author
Jayson Hao
Founder of Innovation Trigger Lab and a University of Toronto Computer Science graduate with an AI/ML focus. He designs and ships production RAG systems, AI chatbots, web platforms and mobile products.
View profileFrequently asked questions
Is PHP still safe to use in 2026?
Yes, if you run a supported branch. PHP 8.2 through 8.5 receive security fixes; 8.1 and older do not. Most PHP site compromises come from outdated versions and plugins, not the language itself.
When does PHP 8.2 reach end of life?
PHP 8.2 receives security fixes until 31 December 2026. After that date it is end of life and should be upgraded to 8.3 or newer.
How do I check which PHP version my website uses?
Check your hosting control panel, or run php -v on the server. Avoid leaving a public phpinfo() page online to find out, because it exposes configuration details to attackers.
Am I affected by CVE-2024-4577?
Only if PHP runs on Windows in CGI mode, as in a default XAMPP setup, and is older than 8.3.8, 8.2.20 or 8.1.29. Servers using Japanese or Chinese system locales are the confirmed targets.
Sources and further reading
- 1.Supported VersionsThe PHP Group (php.net)
- 2.Usage statistics of PHP for websitesW3Techs, October 25, 2026
- 3.PHP RCE: A Bypass of CVE-2012-1823, Argument Injection in PHP-CGI (CVE-2024-4577)PHP (php-src GitHub Security Advisory), September 28, 2024
- 4.Unmasking the new persistent attacks on JapanCisco Talos, March 6, 2025
- 5.State of WordPress Security in 2026Patchstack, February 25, 2026
- 6.OWASP Top 10:2025OWASP Foundation
