
docker-php-extension-installer
Easily install PHP extensions in Docker containers
The Lens
By Erik Loyd, SaaS CEO and former COO/CFO of an AWS Premier Partner.
Updated Oct 2026
docker-php-extension-installer fixes one of the most annoying parts of PHP in Docker: getting extensions like GD, Xdebug, Redis or Imagick into the official php images. Instead of hunting down system libraries and compiling by hand, you run install-php-extensions gd xdebug. It installs the build packages, compiles, enables the extension and removes what it no longer needs so the image stays small. MIT, free.
Usage is one Dockerfile line: ADD the script from the latest GitHub release, or COPY --from the maintainer's image on Docker Hub or GHCR. It supports Debian images back to Debian 8 and Alpine back to 3.9, pins extension versions (xdebug-^3), and installs Composer too. Nothing to run, nothing to buy. Solo, small and larger teams: free. It replaces hand-written docker-php-ext-install and pecl lines.
The catch: every README example pulls the latest release, and releases go out almost daily, so today's build may run a different script than yesterday's. Some libraries are fetched at their newest upstream version, and some extensions default to non-stable PECL builds. Pin a release tag in production. It's also essentially a one-maintainer project, though a steady one since 2018.
Free vs Self-Hosted vs Paid
fully freeFree: Everything. One MIT-licensed shell script that installs PHP extensions (and optionally Composer) inside the official PHP Docker images.
Self-hosted: Nothing to host. Pull the script into your Dockerfile from the GitHub release, or copy it from the mlocati/php-extension-installer image on Docker Hub or ghcr.io/mlocati/php-extension-installer. Supports Debian-based images since Debian 8 (PHP 5.5+) and Alpine since 3.9 (PHP 7.1+). Environment variables control debug output, version pinning of bundled libraries, and whether extensions are enabled.
Paid: There is no paid tier. Some extensions it can install talk to paid services (New Relic, Datadog tracing, Blackfire), and those bill separately.
Free, with nothing to buy. The only real cost is pinning a release so your builds stay reproducible.
What to do by team size
- Solo
- free; one line in the Dockerfile
- Small team
- free; pin a release tag
- Medium team
- free; pin a release and mirror the script or image for reproducible builds
- Large team
- free; vendor a pinned copy and review the diff when you bump it
Get tools like this every Wednesday
One featured tool, three on the radar. No fluff.
A low score is not a verdict on quality. Young and niche tools start low by design. How we calculate scores
Trust Signals
About
- Owner
- Michele Locati (User)
- Stars
- 4,994
- Forks
- 435
Explore Further
More tools in the directory
Stirling-PDF
#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
95.8k ★mastodon
Your self-hosted, globally interconnected microblogging community
50.5k ★1Panel
🔥 1Panel is a modern, open-source VPS control panel, and the only one with native AI agent support. Run Ollama models, deploy OpenClaw agents, and manage your entire server stack from one clean web interface.
37.4k ★