Tools/mlocati/docker-php-extension-installer

docker-php-extension-installer

Easily install PHP extensions in Docker containers

5.0k ★+3/wkemergingShellMIT License →trending

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 free

Free: 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
Self-hosting ops:trivial

Get tools like this every Wednesday

One featured tool, three on the radar. No fluff.

Score
74/100 · B+
Adoption17/30
Maintenance25/25
Community7/20
License15/15
Analysis10/10

A low score is not a verdict on quality. Young and niche tools start low by design. How we calculate scores

Trust Signals

Community discussions enabled

About

Owner
Michele Locati (User)
Stars
4,994
Forks
435

Explore Further

More tools in the directory