phpatch.com

← phpatch.com home

Roll Back a PHP Update Safely

By PHP Patch Assurance · Last updated: 2026-10-25 · Plain-text version

Rolling back a PHP update means returning the server to the exact PHP version and configuration it ran before the update. It is the safety net that makes patching low-risk: if the new version breaks the site or fails its health check, you revert instead of debugging under fire. A rollback only works if it was prepared before the patch.

The rule: prepare before, not after

A rollback prepared after a failed patch is improvisation. Before patching: snapshot the server, keep the previous Docker image tagged, or note the previous package versions. The rollback path should be written down before the patch starts, not invented while the site is down.

Docker rollback

Restart the previous image and verify. Keep it tagged — a naming scheme such as phppatch-backup-<service>:<timestamp> makes the right image easy to find under pressure. Verify the version and the key pages after the revert, exactly as after a patch.

apt rollback

apt has no undo, so the reliable path is a snapshot restore. If the previous package version is still in the repository, reinstalling it is a second option — apt-cache policy php8.3 shows what is available — but configuration changes made during the upgrade may not revert with the package. The snapshot is the clean answer.

Test the rollback before you need it

Rehearse on staging: patch, break something on purpose, roll back, verify. A rollback you have never run is a guess, and guesses fail under pressure. The rehearsal also tells you how long a real rollback takes, which is what you will tell users if it ever happens.

When not to roll back

If the new version works and the old one is vulnerable, rolling back re-exposes the site. In that case fix forward: keep the patched version and repair the breakage, rather than returning to a known-vulnerable release to buy comfort.

Check your site free Patch service

This guide pairs with the patch service.

Frequently asked questions

How long do I keep the snapshot?

Until the new version has run clean for several days. PHPatch's own patch flow retains snapshots for 72 hours; for a self-run patch, keep yours at least that long.

What do I verify after a rollback?

The same health checks as after a patch: version, key pages, error log. A rollback that is not verified is just a second unplanned change.

Does the patch service roll back automatically?

Yes, for Docker hosts: a failed health check reverts the change automatically, and if the patch cannot be completed and verified, or the pre-patch state cannot be restored, the fee is refunded in full.

← Guides