Sign inSign up

lampelk/php-fpm

By lampelk

•Updated 3 days ago

PHP 8.5.12-FPM for Symfony apps in production: intl, gd, redis, amqp, apcu, opcache & more.

Image
0

2.1K

lampelk/php-fpm repository overview

⁠lampelk/php-fpm

A production PHP-FPM image for Symfony and other modern PHP applications. It's built on the official php:8.5.12-fpm⁠ image (Debian 13 trixie) and adds the extensions most apps need, a hardened configuration and a built-in health check.

Use it with lampelk/nginx⁠ in front. For local development, use lampelk/php-fpm-dev⁠.

⁠Tags

TagDescription
latestCurrent stable build (PHP 8.5.12). Rebuilt on every change and for each PHP security release.

Any other tag is a pre-release build of work in progress. Don't use one in production.

latest moves. For reproducible deploys, pin the image by digest, for example image@sha256:…. Then bump the digest when a new build is published.

⁠Use as a base image

FROM composer:latest AS composer

FROM lampelk/php-fpm:latest
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
COPY --chown=www-data:www-data . /var/www/html
RUN composer install --no-dev --optimize-autoloader --no-interaction

The working directory is /var/www/html, and nginx serves /var/www/html/public. Composer isn't included in this image. Copy it in, as shown above, or install dependencies in CI.

⁠PHP extensions

ExtensionNotes
amqpRabbitMQ / Amazon MQ. The Amazon Root CA is at /var/certs/amazon-root-ca.pem
apcu
gdWith FreeType, JPEG and WebP support
intl
memcached
mysqli, pdo_mysql
opcacheEnabled
pcntl
redis
xsl
zip

The upstream defaults (curl, mbstring, openssl, sodium, pdo_sqlite, xml, …) are also included. Run php -m inside the container for the full list.

Build tools and -dev headers are kept in the image, so you can add more extensions in your own Dockerfile with docker-php-ext-install or pecl install.

⁠Configuration

SettingValue
memory_limit512M
expose_phpOff
session.upload_progress.enabled0
fatal_error_backtraces0
opcache.enableOn

To override settings, add your own .ini to /usr/local/etc/php/conf.d/, for example:

RUN echo 'memory_limit = 1G' > /usr/local/etc/php/conf.d/zz-app.ini

⁠PHP-FPM

  • Port: 9000.
  • Health check: a Docker HEALTHCHECK runs php-fpm-healthcheck⁠ every 30 seconds. The script is pinned and checksum-verified at build time.
  • Status page: pm.status_path = /status. It can only be reached over FastCGI, and lampelk/nginx never routes it to FPM.
  • Command: php-fpm.

⁠Local development with Docker Compose

lampelk/nginx⁠ forwards PHP requests to localhost:9000, so it shares the PHP container's network:

# compose.yaml
services:
  php:
    image: lampelk/php-fpm-dev:latest
    volumes:
      - ./:/var/www/html
    ports:
      - "8080:80"            # nginx shares this container's network, so publish its port here
    extra_hosts:
      - "host.docker.internal:host-gateway"   # lets Xdebug reach your IDE on Linux

  nginx:
    image: lampelk/nginx:latest
    network_mode: "service:php"
    volumes:
      - ./:/var/www/html
    depends_on:
      - php

Run docker compose up -d, then open http://localhost:8080⁠. The app's front controller must be at public/index.php.

⁠Security updates

These images are rebuilt from the official PHP⁠ and nginx⁠ images. Each build picks up the latest upstream and Debian security fixes, and the PHP version is bumped for every PHP security release. To get a fix, pull and redeploy. Running containers are not updated automatically.

ImagePurpose
lampelk/php-fpm⁠PHP-FPM for web apps in production
lampelk/php-cli⁠PHP CLI for workers, consumers and cron in production
lampelk/php-fpm-dev⁠php-fpm + Xdebug, Composer and Symfony CLI for local development
lampelk/php-cli-dev⁠php-cli + Xdebug, Composer and Symfony CLI for local development
lampelk/nginx⁠Hardened nginx to sit in front of php-fpm

⁠License

Released under the MIT License.

Tag summary

Content type

Image

Digest

sha256:d980721b1…

Size

241.2 MB

Last updated

3 days ago

docker pull lampelk/php-fpm