Solution

How to install PHP 7.2 with Docker

Package an old PHP 7.2 runtime into a repeatable container layout so legacy code can stay isolated from the host.

Updated 2026-03-27

Problem statement

What is the stable way to keep PHP 7.2 running on a modern Docker host?

The reliable approach is to contain the old PHP runtime inside Docker, keep its files and config in explicit host paths, and avoid mixing those legacy dependencies into the base system.

A scripted install makes this easier to recreate when the container needs to be rebuilt or handed off to another operator.

What to check

  • Keep the old runtime isolated from the host OS.
  • Make config and code paths explicit on the host.
  • Prefer repeatable container bootstrap over manual recovery.

Parent topic

Maintain older application stacks such as PHP 7.2 and Workerman on Docker while keeping deployment steps standardized enough for handoff and recovery.