# PHP Docker Image

A small Alpine-based PHP 8.4 image with Composer, FPM and cron built in.

## Details

- Platform: Docker
- Published: January 4, 2026
- Distribution: GitHub Container Registry
- Price: Free
- Install: `docker pull ghcr.io/awesoft/php:8.4`
- View on GitHub: https://github.com/awesoft/php-docker

## Overview

A minimal, production-ready PHP runtime built on the official `php:*-alpine` images. It ships the extensions most
PHP applications need, Composer 2, and runs as a non-root `app` user, so the same image can run a script on your
laptop, Composer in a CI job and PHP-FPM behind a web server without anyone setting up PHP by hand.

## What's inside

- **Extensions:** bcmath, bz2, calendar, exif, ftp, gd, gettext, gmp, intl, mysqli, opcache, pdo_mysql, pcntl, redis, shmop, soap, sockets, sodium, sysvmsg, sysvsem, sysvshm, tidy, xsl and zip.
- **Debugging on demand:** xdebug and pcov are installed but off; start the container with `DEBUG_ENABLED=1` to turn them on.
- **Composer 2** with a cache you can mount at `/.composer`.
- **Entrypoints:** `run-fpm` starts PHP-FPM, `run-cron` starts the cron daemon and installs `/app/crontab` if present (`CRONTAB_FILE` overrides the path).
- **Non-root:** processes run as the `app` user (UID 1000).

## Usage

Run a PHP command without installing PHP locally:

```bash
docker run -it --rm ghcr.io/awesoft/php:8.4 php -v
```

Mount the current directory at `/app` and work inside the container:

```bash
docker run -it --rm -v $(pwd):/app ghcr.io/awesoft/php:8.4
```

Serve an application with PHP-FPM and run scheduled jobs from the same image:

```bash
docker run -d -v $(pwd):/app ghcr.io/awesoft/php:8.4 run-fpm
docker run -d -v $(pwd):/app ghcr.io/awesoft/php:8.4 run-cron
```

---

Canonical: https://awesoft.dev/docker/php-docker-image/
Markdown: https://awesoft.dev/docker/php-docker-image/index.md
