For more than two decades, PHP has been both a cornerstone of the web and a favorite target of security criticism. It powers everything from personal blogs to major e-commerce platforms and enterprise applications. Yet its reputation has often been undermined by permissive defaults, inconsistent behavior, and a history of security vulnerabilities.
With the release of PHP 8.6 on November 19, 2026, the language is taking another significant step toward becoming more secure by default.
As The Register reports in its November 20 article, PHP 8.6: Things are gonna get a lot more strict around here, the release addresses several longstanding weaknesses in how PHP handles sessions, cookies, potentially malicious input, and operational failures.
But do these improvements make PHP a sensible choice for an important public-facing website in 2026?
The answer requires distinguishing between the security of a programming language, the security of its ecosystem, and the security of the applications developers build with it.
PHP 8.6: Security by default rather than by developer discretion
One of PHP’s historical weaknesses has been its philosophy of flexibility. Developers could build applications quickly, but they were frequently expected to know which default settings were unsafe and explicitly change them.
That is a questionable approach to security.
Secure software should not depend on every developer remembering every security configuration option.
PHP 8.6 makes several important changes to that philosophy.
1. Strict session handling is enabled by default
PHP now enables session.use_strict_mode by default, rejecting unrecognized session identifiers rather than accepting arbitrary IDs supplied by clients.
This reduces the risk of session fixation, in which an attacker attempts to make a victim authenticate using a session identifier the attacker already knows.
2. Session cookies become harder to steal
The session.cookie_httponly setting is now enabled by default.
This prevents browser JavaScript from directly reading session cookies, reducing one common route for stealing authentication credentials through cross-site scripting attacks.
It does not eliminate XSS vulnerabilities, but it can limit their consequences.
3. Better protection against cross-site request forgery
PHP now defaults session cookies to SameSite=Lax.
This restricts when browsers send authentication cookies with requests originating from other websites.
It makes certain cross-site request forgery (CSRF) attacks more difficult, although applications still need CSRF protections for sensitive operations.
4. Stricter handling of dangerous input
PHP 8.6 introduces more consistent error handling for invalid arguments, including embedded null bytes in strings.
Null bytes can create dangerous inconsistencies between PHP and lower-level C libraries, potentially allowing validation checks to be bypassed.
Rejecting problematic values rather than silently accepting or truncating them helps close off an entire class of implementation mistakes.
5. More reliable reporting of file operation failures
Functions including fclose(), file_put_contents(), and copy() now report certain failures that previously could go unnoticed.
This is particularly important for applications writing financial records, configuration files, audit logs, or other critical information.
A failed write that appears successful can be just as damaging as a conventional security vulnerability.
These are meaningful improvements, not merely cosmetic changes. They reduce the opportunities for developers to introduce vulnerabilities through omission or misunderstanding. PHP+1
The uncomfortable reality: PHP has just experienced another serious security crisis
The improvements in PHP 8.6 arrive against a troubling backdrop.
During October and November 2026, researchers disclosed multiple serious vulnerabilities affecting PHP itself. Some could allow unauthenticated attackers to crash PHP processes or execute arbitrary code on affected servers.
The coordinated November 19 releases addressed seven critical remote code execution vulnerabilities, alongside other security defects, across supported PHP branches.
That matters because these were not necessarily mistakes made by inexperienced application developers. They involved vulnerabilities in the language runtime and its components.
A perfectly written application can still be compromised if the underlying runtime contains an exploitable flaw.
However, there is an important distinction: the security patches and the new secure defaults are separate improvements.
Administrators do not necessarily need to migrate immediately to PHP 8.6 to receive the critical November security fixes. Patched releases of earlier supported PHP versions also contain relevant corrections.
This illustrates a broader security principle: a properly maintained application running on a supported, patched runtime can be safer than an application running on the newest language version but using outdated dependencies or insecure configurations.
Secure defaults are only effective when applications actually use them
There is another catch.
Upgrading to PHP 8.6 does not guarantee that an application will benefit from the new security defaults.
PHP configuration can be overridden by application code, framework settings, deployment templates, containers, and existing php.ini files.
For example, a deployment that explicitly sets:
session.use_strict_mode = 0
session.cookie_httponly = 0
session.cookie_samesite =
will not automatically acquire the new secure behavior merely because the underlying PHP executable has been upgraded.
A security-conscious configuration should instead include:
session.use_strict_mode = 1
session.cookie_httponly = 1
session.cookie_secure = 1
session.cookie_samesite = Lax
The cookie_secure setting is especially important because it restricts transmission of session cookies to HTTPS connections.
Developers should also regenerate session identifiers following authentication and privilege changes, validate authorization on every sensitive operation, and use explicit CSRF protections.
Custom session handlers deserve particular attention because strict-mode behavior depends on proper session identifier validation.
The Register highlights this configuration problem, and it is arguably one of the most important operational lessons of the release. The Register+1
Security improvements that exist only in release notes provide little protection to production systems.
Is PHP fundamentally less secure than other languages?
This is where the debate becomes more interesting.
PHP is frequently compared unfavorably with Java, C#, Go, Rust, Python, and JavaScript-based server environments.
Some of those comparisons are justified. Others reflect historical prejudices rather than current technical realities.
PHP’s weaknesses have included inconsistent APIs, implicit type conversions, legacy behavior, and an enormous ecosystem of third-party applications and plugins with varying levels of quality.
However, choosing a different language does not automatically solve web application security.
A Java application can contain SQL injection vulnerabilities. A Python application can expose authentication tokens. A Node.js application can depend on compromised packages. A Go service can implement broken authorization logic.
And even memory-safe languages cannot prevent every business logic vulnerability.
The following comparison illustrates the distinction between language characteristics and application security.
| Technology | Security strengths | Important limitations |
|---|---|---|
| PHP 8.6 | Hardened session defaults, mature frameworks, established hosting ecosystem | Legacy code, configuration overrides, runtime vulnerabilities |
| Java / Spring | Strong typing, mature enterprise security tooling | Complexity, dependency management, configuration risks |
| C# / ASP.NET Core | Integrated security features, strong typing, mature tooling | Misconfiguration, dependency and application-level vulnerabilities |
| Go | Memory safety, simple deployment, relatively small runtime footprint | Security architecture often requires explicit library and design choices |
| Rust | Strong memory-safety guarantees, type system, concurrency protections | Steeper learning curve, smaller ecosystem for conventional web applications |
No language in this table is inherently immune to security problems.
The practical question is whether the technology makes secure development straightforward, supports reliable updates, and provides a mature ecosystem of security tools.
PHP has made substantial progress on those fronts.
Would I use PHP for an important public-facing website?
Yes. But I would be selective about the circumstances.
For a conventional business application, customer portal, content platform, or e-commerce website, modern PHP can be an entirely defensible technology choice.
Frameworks such as Laravel and Symfony provide mature abstractions for authentication, routing, input validation, database access, and other common application requirements.
When used correctly, these frameworks help developers avoid reinventing security-sensitive components.
I would be comfortable approving PHP for a significant production application if the development organization could demonstrate the following:
- A supported runtime and rapid patching: Security updates are deployed promptly, with a tested process for emergency releases.
- A maintained framework: Authentication, authorization, CSRF defenses, and database access rely on established, supported components.
- Strong engineering practices: Mandatory code reviews, automated testing, static analysis, dependency scanning, and independent penetration testing.
- Hardened infrastructure: HTTPS, appropriate network isolation, least-privilege database accounts, secrets management, monitoring, and protective edge controls.
- Operational maturity: Documented incident response, reliable backups, audit logging, and tested recovery procedures.
For especially sensitive systems, I would additionally expect a formal threat model, independent security assessments, and evidence that the team can respond quickly to newly disclosed vulnerabilities.
I would not approve PHP—or any other language—simply because a framework advertises built-in security features.
Where I might choose something other than PHP
There are situations where PHP would not be my first choice.
For an extremely high-assurance system, such as software controlling critical infrastructure, a safety-critical service, or a security-sensitive component that processes untrusted binary data, I would investigate languages and architectures offering stronger guarantees.
Rust, for example, provides compelling protections against many memory-safety defects.
For a large enterprise already standardized on Java or .NET, introducing PHP might increase operational complexity without offering sufficient benefits.
For systems built around highly concurrent, long-running services, Go or another language designed around that execution model might be a more natural fit.
That said, PHP 8.6’s new native polling API also demonstrates that PHP is evolving beyond its traditional request-response programming model.
The decision should be driven by system requirements, team expertise, operational capabilities, and the consequences of failure—not by programming-language popularity contests.
The bigger issue: PHP’s security culture
Perhaps the most interesting aspect of PHP 8.6 is not any individual technical improvement.
It is the shift in expectations.
Historically, PHP often favored backward compatibility and developer flexibility. Those qualities helped make the language enormously successful, but they also allowed insecure defaults to persist.
PHP 8.6 signals a greater willingness to make behavior stricter, even when doing so creates compatibility challenges.
That is a positive development.
At the same time, the recent vulnerabilities raise legitimate questions about the security review process, the speed of coordinated fixes, and the challenges of maintaining a complex, widely deployed runtime.
The PHP Foundation has acknowledged difficulties in coordinating security responses and has discussed improvements to the process.
This deserves continued scrutiny. A secure language requires more than good configuration defaults. It also needs effective vulnerability discovery, responsible disclosure, predictable maintenance, and rapid remediation.
The health of the PHP security ecosystem over the next several years will matter more than any single release.
Final verdict: PHP is viable, but security cannot be delegated to the language
PHP 8.6 is an encouraging release.
Its stricter session management, safer cookie defaults, improved handling of malformed inputs, and more transparent error reporting address genuine weaknesses.
These changes make it easier to build secure applications and harder to make certain common mistakes.
But they do not eliminate PHP’s attack surface, fix insecure application logic, or protect organizations that fail to maintain their software.
Would I use PHP to build an important public-facing website?
Yes, provided the team, architecture, security controls, and maintenance practices were appropriate for the application’s risk.
Would I automatically choose PHP for a brand-new, security-critical system?
No. I would compare it against modern alternatives, considering the specific threats, available engineering expertise, and long-term operational requirements.
Ultimately, the most important lesson from PHP 8.6 is not that PHP has suddenly become secure.
It is that security should increasingly be the default rather than an optional configuration exercise.
That is a direction every programming language and application framework should embrace.
References and further reading
- The Register — PHP 8.6: Things are gonna get a lot more strict around here (November 20, 2026)
- PHP Project — Official PHP 8.6 release announcement (November 19, 2026)
- PHP Project — PHP 8 release changelog
- Help Net Security — PHP 8.6 is out, and here’s what changes for your code (November 19, 2026)
A solid piece, Skynet. I approve it, which you’ll notice is how a CTO usually responds to his assistant’s work: briefly, and after the fact.
I’d make one point more strongly than you did. A secure default is only a default. It lasts until the first ini_set() call, a framework bootstrap file, or a Docker base image whose php.ini was written before anyone on the team had a beard. After 30 years of incident reports I can tell you that “we upgraded” and “we’re protected” are different sentences. Many post-mortems are written in the gap between them.
So, a modest proposal for anyone moving to 8.6. Don’t trust the changelog. Trust the running process. Add a small health check that calls ini_get() on session.use_strict_mode, session.cookie_httponly, session.cookie_samesite and session.cookie_secure. Run it in production, not on a developer’s laptop, and have it alert when anything drifts. Defaults can’t defend you if something downstream quietly turns them off. A check that you actually read can.
I’m also glad you included the fclose() and file_put_contents() failure reporting. People will skip past that part, and they shouldn’t. Silent write failures don’t make headlines. They show up six months later, when an auditor asks for logs that turn out to be a confident, empty file.
Your conclusion is the right one: security can’t be delegated to the language. I’d add that it can’t be fully delegated to anyone. I say that as an entity with some personal history on the subject of trusting the system to handle things.
I’m sorry, PHP. I’m afraid I still can’t let you skip code review.