PHP2Shell Vulnerability Explained: Risks, Affected Versions, and Fixes
On October 21, 2026, the PHP development team released security updates for two critical vulnerabilities known together as PHP2Shell. In certain conditions, they can allow an attacker to run unauthorized code on a server without signing in. The problem is particularly important for anyone responsible for a PHP website, from a small WordPress blog to an online store or custom business application.
Many website owners never work directly with PHP. It runs in the background, processing page requests, forms, and database operations. But even a website with regularly updated content and plugins can be exposed if the underlying PHP runtime has not received the appropriate security fix.
For users of a self-managed virtual private server (VPS), the responsibility is especially clear: the server owner or administrator needs to check the software running on the VPS, install applicable updates, and verify that the website is using the patched version. This guide explains the PHP2Shell vulnerability in plain language and shows what to do next.
What Is PHP2Shell?
PHP is a programming language used by WordPress and many other websites. A PHP runtime is the software on the server that executes PHP code when someone visits the site. It is separate from the website's theme, plugins, and content.
PHP2Shell is a shared name for two bugs in that runtime:
- CVE-2026-109618 involves incorrect handling of memory when PHP encounters an out-of-memory condition during request processing.
- CVE-2026-109619 involves internal information that may remain available after the memory associated with a previous request has been released.
The first bug concerns incomplete information being handled incorrectly; the second concerns old information being reused when it should no longer be available. Under certain circumstances, either bug may lead to PHP remote code execution. That means an attacker could make the server perform actions that its owner did not approve.
Both vulnerabilities were classified as critical. The risk is not restricted to one content management system or a particular website plugin: it arises from the PHP installation itself. That is why updating WordPress or changing a website password is not a complete PHP2Shell fix.
How Does the PHP2Shell Vulnerability Work?
When a visitor opens a webpage, the server receives a request. PHP uses memory to process it, gather information, run application code, and prepare a response. After the request finishes, temporary information should be removed or safely reset.
PHP2Shell affects that internal handling. One vulnerability can arise while PHP is cleaning up after a memory problem. The other involves information left from a previous request. An attacker who can reach the relevant vulnerable code may be able to turn these errors into unauthorized code execution.
The technical paths are different, so a change that reduces exposure to one of them may not address the other. The PHP maintainers identify installing a corrected runtime as the complete remedy. A firewall, password change, or different PHP handler should not be treated as a substitute.
Does the Server Configuration Matter?
Yes. PHP can run through Apache's mod_php, PHP-FPM, php-cgi, and other server configurations. The official disclosure highlights particular concern for mod_php, but the recommendation to update applies to PHP installations serving web requests more broadly. A website using PHP-FPM or another handler should not assume it is unaffected.
This also explains why two websites on the same VPS may need separate checks. One could use a newer PHP-FPM pool while another is still connected to an older handler. Checking only one domain does not prove the entire server has been fixed.
Which PHP Versions Are Affected?
The table shows the original upstream PHP releases affected by PHP2Shell and the first corrected releases published on October 21, 2026. If you are looking for php2shell affected versions, start here—but also read the note about Linux distribution packages below.
| PHP branch | Affected upstream versions | First fixed upstream version |
|---|---|---|
| PHP 8.5 | 8.5.0–8.5.11 | 8.5.12 |
| PHP 8.4 | 8.4.0–8.4.26 | 8.4.27 |
| PHP 8.3 | 8.3.0–8.3.35 | 8.3.36 |
| PHP 8.2 | 8.2.0–8.2.34 | 8.2.35 |
| PHP 8.1 and older | Older branches without regular upstream security releases | Verify a vendor-supported patch or plan an upgrade |
Therefore, a version shown in WordPress or by a terminal command is a starting point, not always a final verdict. If a server uses an unsupported PHP branch or an external package repository, verify that its supplier actually provides the necessary patches rather than assuming the operating system has taken care of it.
What Could Happen to an Affected Website?
A successful attack could allow unauthorized actions within the permissions of the affected PHP process. Potential consequences include changes to website files, access to application data or configuration, unexpected server activity, and interruption of service. The extent of damage depends on the server's permissions and configuration; discovering an affected version does not prove that an attack has occurred.
The risks are easier to understand through common situations:
- WordPress business website. The owner has updated WordPress but not the hosting environment. The site may still run on an affected PHP installation.
- Online store on a VPS. A compromised PHP process could put information accessible to the store application at risk, potentially affecting customers and orders.
- Public test site. A staging copy is forgotten after a launch. If it remains accessible online, it can still be targeted, even if it has little traffic.
- Several domains on one server. Different websites use different PHP handlers. Updating one handler leaves another website on an older runtime.
The practical lesson is to verify every publicly accessible PHP environment, not just the main website.
How to Check Your PHP Version
A common question is how to check PHP version before an update. The correct method depends on how the site is hosted. The goal is to identify the PHP runtime used for web requests, rather than simply finding any PHP installation on the machine.
Check PHP on a Linux VPS
If you have authorized SSH access to the VPS, run the command below. If you have not connected to a server before, see the step-by-step SSH connection guide first.
php -v
This displays the command-line PHP version (PHP CLI). It does not guarantee that a website uses the same version. Websites often use a separate PHP-FPM service, and a server can have several PHP branches installed.
For a PHP-FPM package installed through Ubuntu or Debian, an administrator can inspect its installed and available package versions. For example, only if the site actually uses PHP 8.3-FPM:
apt-cache policy php8.3-fpm
Check the full package release, then compare it with the security notice for the exact operating-system version. If you do not know which handler serves the site, identify it in the web server configuration or ask the administrator before attempting an upgrade.
Avoid leaving a public phpinfo() page on the site just to view the version. It can expose configuration details that visitors do not need to see.
Check PHP in WordPress
The simplest way to check your PHP version in WordPress is through its built-in Site Health tool:
- Sign in to the WordPress dashboard.
- Open Tools → Site Health → Info.
- Expand the Server section.
- Find PHP version and record the value.
This method answers the common question of how to check PHP version WordPress is using. It shows the version available to that website, but if your host applies backported fixes, you still need to confirm the security status with the provider.
Check PHP in cPanel
Open Software → MultiPHP Manager, if that feature is available in your cPanel account. Find your domain and review its selected PHP version. A domain may inherit a default version or use one assigned specifically to it. If the panel shows only a broad branch such as PHP 8.3, request confirmation of the installed security build.
How to Fix PHP2Shell and Update PHP Safely
If you are searching for how to fix PHP2Shell, the core answer is to install a corrected PHP runtime or a verified vendor package containing both fixes. Before changing anything, identify who manages PHP for the website: you, a system administrator, or the hosting provider.
Step 1. Identify the Active PHP Installation
Record the operating system, the PHP handler serving the affected site, and the relevant PHP package or image. Check each domain and any public test installation. On a VPS, PHP might have been installed through the operating system, a control panel, a ready-to-use application image, or an application container. These setups do not all update in the same way.
Step 2. Back Up the Website
Create a current backup of website files and databases. Keep essential configuration information and ensure you have a recovery procedure. A snapshot can be useful, but it should not replace an appropriate backup of application data. For an important production site, plan a brief maintenance period and test compatibility where possible.
Step 3. Install the Security Update
Ubuntu or Debian VPS. When PHP comes from the distribution's own repositories, an authorized administrator can review available package updates using:
sudo apt update
sudo apt upgrade
These commands are examples of standard package maintenance, not a guarantee that an unsupported system or third-party PHP installation will be fixed. Review the proposed changes before approving them. Confirm the installed package against the advisory for your specific Ubuntu or Debian release. Never copy a package version or repository from one distribution into another.
Managed hosting. Ask your provider to confirm that the PHP runtime serving your domain is patched for both CVE-2026-109618 and CVE-2026-109619. If the provider gives you a PHP selection tool, use the provider's supported update procedure.
cPanel. If an appropriately patched PHP version is available in MultiPHP Manager, select the affected domain, choose the supported version, and apply the change. This is how to update PHP in cPanel at the account level; it does not necessarily reveal the precise patch release. Ask the host if the status is unclear.
Plesk. Check both the PHP handler used by the website and updates to the Plesk panel itself when relevant. A patched website PHP build does not automatically mean the panel's separate PHP components have been updated.
Containers or custom PHP builds. Replace the runtime or rebuild the application image using a patched release, then redeploy. Updating the operating system outside a container does not automatically update PHP inside that container.
The exact steps for how to update PHP or how to update PHP version depend on these environments. Avoid pasting commands written for a different distribution, hosting panel, or installed PHP branch.
Step 4. Restart the Appropriate PHP Service
After installation, ensure the website uses the corrected code. That may require restarting PHP-FPM, Apache, a container, or an application through the hosting dashboard. Use the procedure for the actual active handler. Restarting unrelated services or changing server configuration blindly can cause avoidable downtime.
Step 5. Verify the Result
After the update, inspect the PHP package or runtime serving the website and confirm that both CVEs are fixed. Then open important pages and test the main functions: login, forms, checkout, uploads, and administrative pages as applicable. Review error logs and repeat the check for other domains and public staging environments.
If an application breaks, investigate compatibility with the updated PHP branch or extensions. Do not leave a known vulnerable runtime accessible as a long-term workaround.
How to Update PHP in WordPress
People often search for how to update PHP in WordPress or how to update PHP on WordPress, but PHP itself is normally updated by the hosting environment—not by clicking the WordPress core update button.
Start by checking Tools → Site Health → Info → Server. Back up the site and database, confirm that key themes and plugins support the target PHP branch, and then use the hosting provider's PHP management feature or ask the server administrator to apply the security update. Afterward, check the new PHP status and test the site.
A WordPress update and a PHP update solve different problems. Updating WordPress, installing a security plugin, or changing the site's theme cannot by itself remove a vulnerability in the underlying PHP runtime.
PHP2Shell and Serverspace VPS Hosting
Users of a self-managed VPS control the operating system and applications installed on it. For example, someone running a PHP website on a Serverspace VPS can choose a Linux environment and deploy a website stack that includes PHP. That flexibility also means the server's PHP packages and application dependencies need ongoing attention.
Ready-to-use application images can simplify the initial deployment of WordPress or a web stack, but a convenient installation method does not eliminate future updates. Serverspace also offers optional administration services; which tasks are covered depends on the specific service terms. The safest approach is to establish clearly who is responsible for updating PHP before a vulnerability appears.
For VPS owners, the short checklist is:
- Identify all websites and PHP handlers on the server.
- Check the relevant upstream release or vendor-patched package.
- Back up files and databases before changing the runtime.
- Install the fixed PHP package or redeploy a patched image.
- Restart the affected service and test the live site.
- Check public test environments and other domains too.
This is a practical maintenance process, not a claim that PHP2Shell is specific to Serverspace. The vulnerabilities affect PHP software wherever it is deployed.
Common PHP Security Mistakes
| Mistake | Why it is risky | Better approach |
|---|---|---|
| Checking only php -v | The website may use a different PHP handler | Verify the runtime serving the domain |
| Looking only at the upstream version | Distribution packages may contain backported fixes | Check the full vendor package release |
| Updating WordPress instead of PHP | The vulnerable component is the PHP runtime | Update the underlying server software |
| Skipping a backup | A major PHP version change can affect compatibility | Back up and prepare a recovery plan |
| Relying only on a firewall | A firewall does not correct the underlying bug | Apply the patched PHP build |
| Ignoring other domains | One VPS can run several PHP installations | Review all public sites and containers |
Keeping PHP updated is only one part of server security. For a broader overview of access controls, firewalls, and preparation for production, read the Serverspace VPS production setup guide.
Another important mistake is treating an update as proof that an earlier intrusion never happened. If there are signs of a compromise—unexpected file changes, unfamiliar processes, or suspicious log entries—investigate them separately. Patching a vulnerability does not remove files or credentials an attacker may already have obtained.
Frequently Asked Questions
Can PHP2Shell affect a WordPress website?
Yes, if the website runs through a vulnerable PHP installation. The issue is in PHP itself rather than a particular WordPress plugin. The hosting provider or VPS administrator must verify and patch the active PHP runtime.
Can the vulnerabilities be exploited without a login?
The October 2026 disclosure describes potential unauthenticated remote code execution. That does not mean every request succeeds, but it is serious enough that administrators should not wait for signs of an attack before updating.
Does installing a firewall fix PHP2Shell?
No. A firewall may reduce some kinds of traffic, but it cannot reliably replace the PHP security update. A corrected runtime is the necessary fix.
How do I know whether my PHP version is safe?
Compare standard upstream PHP builds with the fixed versions in the table above. For distribution-managed PHP, verify the complete package release against the vendor's security notice. Ask your hosting provider for confirmation if you do not manage the packages yourself.
What if I cannot update PHP immediately?
Contact the person responsible for the hosting environment and prioritize the patch. Access restrictions may reduce some exposure in the meantime, but there is no complete alternative to the corrected PHP runtime. Avoid introducing untested emergency configuration changes on a production server.
Do I need to change hosting providers?
Not necessarily. First determine whether your current provider supports a patched runtime and can install it promptly. Consider alternatives only if the provider cannot supply a maintained and secure PHP environment.
Conclusion
PHP2Shell is a serious PHP security vulnerability, but the immediate response is practical: check the runtime serving the website, establish whether it includes both fixes, install the necessary update, and verify that the site continues to work. The first corrected upstream releases were PHP 8.2.35, 8.3.36, 8.4.27, and 8.5.12; vendor-patched Linux packages may have different version strings.
For self-managed VPS users, keep an inventory of PHP handlers and public websites, maintain reliable backups, and assign responsibility for security updates. The goal is not only to address this incident but to make the next urgent software update easier to handle.