# Patch PHP Without Downtime

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

Patching PHP without downtime means replacing the PHP version while the site keeps answering visitors. The trick is doing the slow work — building and verifying the fixed version — before the swap, so the only interruption is the seconds it takes to switch traffic. For a single host that is seconds of downtime; a blue-green setup can approach zero.

## The principle: slow work before the swap

Every minute spent building, testing and verifying the fixed version happens while the old version serves. The swap itself is then just a container restart or a service switch — seconds, not a maintenance window. Downtime is a function of how much work you left until swap time.

## Docker: build while serving, swap in seconds

Build the pinned image, verify it, then swap containers. The mitbbs.ai php2shell patch followed exactly this path: the image was built while the old container served, the swap took about 10 seconds, and the site answered 200 again about 4 seconds after the new container started. Full detail is in the [case study](/case-studies/mitbbs-ai).

## PHP-FPM: restart, don't reload, for a new version

A configuration reload does not pick up a new PHP binary — a version change needs the pool restarted, which briefly drops in-flight requests. For true zero-downtime with PHP-FPM, run two pools behind a load balancer and move traffic between them; on a single host, schedule the restart and call the seconds what they are.

## What still needs a window

Database migrations, major branch upgrades with breaking changes, and single-host Apache restarts can need a real window. Claiming zero downtime for those is how a patch day becomes an incident. Say seconds when it is seconds, and schedule a window when it is a window.

## The gate: health check and automatic rollback

After the swap, run the health checks from the [health-check guide](/guides/php-health-checks). If any check fails, roll back immediately — see the [rollback guide](/guides/rollback-php-update) — and diagnose with the old version serving. A patch without a gate is a gamble, however fast the swap was.

## Frequently asked questions

### Is zero downtime really zero?

For a single host, no — it is seconds. True zero needs redundant serving capacity, such as two pools or two hosts behind a load balancer. The honest claim for a Docker swap is seconds, and that is already a different experience from a maintenance window.

### What about database changes?

A PHP patch alone does not touch the database, so it needs no migration window. If your change also includes a migration, that migration — not the PHP version — sets the window.

### Can PHPatch do this for me?

For Docker hosts, yes: the patch service follows this exact path — snapshot and restore-test first, patch, live verification, work report — for $49, or $99 with rollback. If verification fails, the change reverts automatically.
