Free guide · no sign-up

Upgrade PHP to a supported branch.

Self-serve companion to the PHP2Shell advisory. If you hit the compatibility pass and it's not worth your time, that's the part 9line does all day.

upgrade.sh — yourdomain.com
[OK]Backup: files + database
[OK]PHP 8.4.27 installed
[OK]Compatibility pass: 3 warnings fixed
[??]X-Powered-By header still exposed
[OK]PHP2Shell (CVE-2026-109618): patched
Exposure closed.
01

Check what you're running

In a terminal over SSH:

php -v

Or check the HTTP header (what an attacker sees):

curl -sI https://yourdomain.com | grep -i 'x-powered-by'

Compare against the PHP2Shell fix versions:

5.4 – 7.4EOL · vulnerablemigrate to 8.2+
8.0 / 8.1EOL · vulnerablemigrate to 8.2+
8.2.x (< 8.2.35)vulnerable≥ 8.2.35
8.3.x (< 8.3.36)vulnerable≥ 8.3.36
8.4.x (< 8.4.27)vulnerable≥ 8.4.27
8.5.x (< 8.5.12)vulnerable≥ 8.5.12
02

Can't upgrade right now? Apply the interim mitigation

This is a stop-gap, not a fix. PHP's own advisory says updating is the only complete remediation. But if you can't touch production today, this closes most of the exposure in the meantime.

In php.ini or your PHP-FPM/web-server pool config (not ini_set() or .user.ini, those run too late to matter here):

session.upload_progress.enabled = 0

On PHP 8.5, also set:

fatal_error_backtraces = 0

Then restart every PHP worker (FPM, Apache mod_php, whatever you run), the setting only takes effect for new workers, not ones already running.

Application-level authentication does not block this vulnerability. PHP processes the malicious request before your app's code ever runs. "It's behind a login" doesn't help if the PHP-FPM/web-server port itself is reachable.

03

Back up everything

  • Files (site root + uploads)
  • Database (full dump)
  • Confirm the backup restores before touching anything else.
tar czf backup-$(date +%F).tgz /path/to/site
mysqldump -u user -p dbname > db-$(date +%F).sql
04

Test on staging first

Never upgrade production directly. Copy the site to a staging host (or a local php -S / Docker container) at the target version and run it there first.

docker run --rm -v "$PWD":/app -p 8000:80 php:8.4-apache
05

Upgrade

How depends on your host:

  • cPanel / shared hosting: MultiPHP Manager → select PHP 8.2/8.3/8.4.
  • Managed host (WP Engine, Kinsta, etc.): the host's dashboard, or ask support to pin the version.
  • VPS / apt: apt install php8.4 (adjust for your distro) and point the web server at the new PHP-FPM.
  • Docker: bump the base image (php:8.4-apache).
06

The compatibility pass (the part people get stuck on)

PHP 8.x removed or changed a lot. Watch for:

  • Removed functions (each(), create_function(), mysql_*, curly-brace string offsets). Grep your codebase:
    grep -rEn 'each\s*\(|create_function|mysql_query|\$str\{' .
  • implode() / array_key_exists() argument order, __autoload, and assert() behaviour changes.
  • WordPress: old themes/plugins that break on 8.x, update them first, then enable WP_DEBUG and fix the notices.
  • Deprecation warnings (libxml, FILTER_SANITIZE_STRING, dynamic properties), fix or suppress until updated.

Enable error reporting in staging and work through it page by page:

ini_set('display_errors', '1');
error_reporting(E_ALL);
07

Deploy and verify

  1. Switch production to the new version.
  2. Re-check the header:
    curl -sI https://yourdomain.com | grep -i 'x-powered-by'
    Confirm it's ≥ 8.2.35 / 8.3.36 / 8.4.27 / 8.5.12.
  3. Spot-check key pages (login, forms, checkout, admin).
  4. Remove the X-Powered-By header entirely so you stop advertising the version, PHP: expose_php = Off in php.ini, or strip it at the web-server/proxy layer.
08

Stay ahead

Subscribe to the PHP release feed and your CMS's security advisories. Or let 9line monitor it for you: 9line.dev/php-security.

Prefer a hand? We'll do the upgrade and compatibility pass and verify it.

Get my site secured →