Last verified ·
PHP2Shell step-by-step response
Commands are examples for the stated environment. Match the branch, service and paths to your site; prepare a backup and a maintenance window before changing production.
Find the Web runtime
WordPress: Tools > Site Health > Info > Server. In a panel, select the domain and its assigned handler. With SSH, map the vhost/socket to its FPM service or container. php -v and php --ini describe CLI only. Never publish phpinfo().
CLI / systemdphp -v php --ini ps -eo pid,lstart,args | grep -E '[p]hp-fpm|[a]pache2|[h]ttpd' systemctl list-units --type=service --all | grep -E 'php.*fpm|apache2|httpd'Prepare a recoverable change
Save site files, database, PHP configuration, extensions and the current image/package revision. Test restoring a copy. Record login, upload, checkout and scheduled-job checks before the change.
Build or pull a patched image
Identify the Compose PHP service and its image. For a Dockerfile, change the PHP base to a compatible patched release and build with --pull; for image-only services, pull the patched tag/digest. Restarting an old container does not install a new image.
Dockerfile · PHP 8.4FROM php:8.4.27-fpmCompose · Dockerfile · phpdocker compose config --services docker compose build --pull php && docker compose up -d --no-deps --force-recreate phpCompose · image · phpdocker compose pull php && docker compose up -d --no-deps --force-recreate phpRecreate and inspect every replica
Deploy the new image with your normal rollout. Check image IDs/digests and php -v inside each PHP container, then verify the domain’s Web runtime. Recreate all replicas, queue workers and schedulers using that image. Preserve volumes; never use down -v as an upgrade step.
Compose · phpdocker compose ps php docker compose images php docker compose ps -q php | while read -r php_container; do docker inspect --format '{{.Image}}' "$php_container" docker exec "$php_container" php -v doneVerify the fix on the running website
Retain runtime/build evidence for both CVEs, restart timestamps and every pool/replica checked. Re-test business functions and effective temporary settings. A hidden response header or a clean URL-check result proves neither patching nor absence of compromise.
If upgrading causes HTTP 500
Keep the public site restricted. Read the first fatal error in private PHP/application logs and compare extensions, INI and Composer requirements. Restore the tested application/database/runtime set if necessary. Restoring a vulnerable runtime is a recovery step, not a security fix.
Docker & container images
A restart of the same container does not install a PHP patch. Pull a patched base image, rebuild the application image and replace all running containers. Pin the validated image digest in production and inspect every replica after rollout. Custom builds and vendor images require their own patch evidence. The example uses PHP 8.4.27 FPM; replace the service placeholder with your real Compose service name.
2. Install a patched build
The first fixed releases are PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12. Choose your existing supported branch or a compatible newer supported branch. Update all matching extensions with the runtime. Test application compatibility and health checks. Fetch releases or packages from PHP or the responsible vendor; an unchanged CMS or a WAF rule is not a runtime patch.
| PHP branch | Upstream releases below | First patched release | Security support ends |
|---|---|---|---|
| PHP 8.5 | < 8.5.12 | ✓ 8.5.12 | Dec 31, 2029 |
| PHP 8.4 | < 8.4.27 | ✓ 8.4.27 | Dec 31, 2028 |
| PHP 8.3 | < 8.3.36 | ✓ 8.3.36 | Dec 31, 2027 |
| PHP 8.2 | < 8.2.35 | ✓ 8.2.35 | Dec 31, 2026 |
No normal PHP project release is available for these branches. Minimal source backports exist for 7.4, 8.0 and 8.1; vendor support must be verified separately. Read guide ↗
3. Restart and verify every instance
Installing a new binary leaves old worker processes in memory until they exit. Restart Apache for mod_php or the corresponding PHP-FPM services and pools. Restart queue workers and scheduled long-running processes too. Verify service start times, Web runtime version, package revision, health checks and every load-balanced replica. Delete any temporary diagnostic page immediately; do not leave phpinfo() publicly accessible.
Command example / DOCKER
# Example base image: choose a supported, patched branch.
FROM php:8.4.27-fpm
# Rebuild from a patched base, then replace running containers.
docker compose build --pull --no-cache
docker compose up -d --force-recreate
docker compose exec <php-service> php -v
docker compose images