PHP guide

Deploy PHP 7.2 in Docker with /data/php7.2 as the host mount

A practical guide to using install_php72_base_docker.sh when Docker is already ready and you need a host-mounted PHP 7.2 runtime for older applications.

4 min read · 2026-03-23

What this script sets up

install_php72_base_docker.sh is for hosts that already have Docker and need a simple PHP 7.2 runtime without hand-building the container configuration first.

It keeps PHP application files, php.ini overrides, and logs under /data/php7.2 so the important project state remains on the host while the runtime stays easy to rebuild.

Terminal output showing install_php72_base_docker.sh deploying PHP 7.2
A real installation run after sanitizing the host name. The script prepares /data/php7.2, pulls php:7.2-fpm, starts php72, and prints the main runtime details.

What it writes to /data/php7.2

The script creates www, conf.d, and logs directories, then writes a baseline php.ini and a placeholder index.php. This gives you a ready-to-edit runtime layout immediately after startup.

  • /data/php7.2/www/index.php
  • /data/php7.2/conf.d/php.ini
  • /data/php7.2/logs/

Where this pattern fits best

This pattern is useful for legacy PHP applications that still depend on PHP 7.2, especially when you want to separate the runtime from the host package manager and keep the code mounted in a visible host path.

It also works well as an intermediate step before wiring Nginx in front, because the PHP-FPM container can be validated first and then connected to a web server later.

Recommended checks after deployment

After the script finishes, confirm that the container is running, port 9000 is mapped as expected, and php -v works inside the container. If you later serve this through Nginx, verify the PHP-FPM upstream before exposing it publicly.

  • docker ps
  • docker logs -f php72
  • docker exec -it php72 php -v
  • docker exec -it php72 php -m

関連トピック

Docker base services for application hosts

Use helper.sh scripts to standardize containerized Nginx, MySQL, Redis, PHP, and Workerman services on long-lived hosts.

トピックを見る

Legacy runtime services on Docker

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

トピックを見る

問題ページ

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.

ページを見る