Sign inSign up

lampelk/php-fpm-dev

By lampelk

•Updated 3 days ago

PHP 8.5.12-FPM for local development: lampelk/php-fpm + Xdebug, Composer & Symfony CLI.

Image
0

1.4K

lampelk/php-fpm-dev repository overview

⁠lampelk/php-fpm-dev

A local development version of lampelk/php-fpm⁠ (PHP 8.5.12). It has the same extensions and setup as production, plus Xdebug, Composer and the Symfony CLI. Code that runs here runs the same way in production.

⁠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.

⁠Development tools

On top of everything in the production image, this image adds:

ToolDetails
Xdebug⁠ 3.5.0debug mode, connects to host.docker.internal:9000 with IDE key PHPSTORM
Composer⁠Latest version at build time
Symfony CLI⁠symfony
git

memory_limit is -1 (unlimited), so Composer, PHPStan and similar tools don't run out of memory.

⁠Configuring Xdebug
To…Do this
Debug from PhpStormListen for debug connections on port 9000
Turn Xdebug off (faster)XDEBUG_MODE=off
Collect code coverageXDEBUG_MODE=coverage
Change the host or portXDEBUG_CONFIG="client_host=… client_port=…"

On Linux, add host.docker.internal:host-gateway to extra_hosts (or --add-host) so Xdebug can reach your IDE.

⚠️ Development only. Xdebug and unlimited memory are unsafe on a public server. Use the production image for anything you deploy.

⁠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.

⁠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.

⁠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:253b6e0c1…

Size

267.8 MB

Last updated

3 days ago

docker pull lampelk/php-fpm-dev