mlocati/docker-php-extension-installer
Snapshot of mlocati/docker-php-extension-installer: 5.0k★, Shell, Developer Tools. Easily install PHP extensions in Docker containers
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Snapshot
Top contributors
Show top contributors
Easy installation of PHP extensions in official PHP Docker images
This repository contains a script that can be used to easily install a PHP extension inside the official PHP Docker images.
The script will install all the required APT/APK packages; at the end of the script execution, the no-more needed packages will be removed so that the image will be much smaller.
Supported docker images are:
- Debian-based docker images: since jessie (Debian 8) (minimum PHP version: 5.5)
- Alpine-based docker images: since Alpine 3.9 (minimum PHP version: 7.1)
See also the notes in the Special requirements section.
Usage
You have many ways to use this script within your Dockerfiles.
Here's a list of sample Dockerfiles that install the GD and xdebug PHP extensions:
Downloading the script on the fly with ADD
FROM php:7.2-cli
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN install-php-extensions gd xdebug
Downloading the script on the fly with curl
FROM php:7.2-cli
RUN curl -sSLf \
-o /usr/local/bin/install-php-extensions \
https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions && \
chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions gd xdebug
Direct execution with curl
FROM php:8.2-cli
RUN ( curl -sSLf https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - || echo 'return 1' ) | sh -s \
gd xdebug
Copying the script from a Docker image
-
using GitHub Container Registry
FROM php:8.4-cli COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions gd xdebug -
using Docker Hub
FROM php:8.4-cli COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions gd xdebug
Warning: by using this method you may use an outdated version of the Docker image.
You may want to run docker pull ghcr.io/mlocati/php-extension-installer or docker pull mlocati/php-extension-installer in order to use an up-to-date version.
Using the script of a Docker image
-
using GitHub Container Registry
RUN --mount=type=bind,from=ghcr.io/mlocati/php-extension-installer:latest,source=/usr/bin/install-php-extensions,target=/usr/local/bin/install-php-extensions \ install-php-extensions gd xdebug -
using Docker Hub
RUN --mount=type=bind,from=mlocati/php-extension-installer:latest,source=/usr/bin/install-php-extensions,target=/usr/local/bin/install-php-extensions \ install-php-extensions gd xdebug
Warning: by using this method you may use an outdated version of the Docker image image.
You may want to run docker pull ghcr.io/mlocati/php-extension-installer or docker pull mlocati/php-extension-installer in order to use an up-to-date version.
Installing specific versions of an extension
Simply append -<version> to the module name.
For example:
install-php-extensions xdebug-2.9.7
The script also supports resolving compatible versions by prefixing the version with a caret (^).
For example:
# Install the most recent xdebug 2.x version (for example 2.9.8)
install-php-extensions xdebug-^2
# Install the most recent xdebug 2.8.x version (for example 2.8.1)
install-php-extensions xdebug-^2.8
Please remark that with the syntax above you'll get the very latest compatible version, which may be unstable. In order to install the most recent stable version, you can append @stable:
# Install the most recent STABLE xdebug 3.x version (for example 3.2.2)
install-php-extensions xdebug-^3@stable
(valid suffixes are: @snapshot, @devel, @alpha, @beta, and @stable)
Pre-release versions extensions available on PECL can be setup by suffixing the extension's name with its state i.e. alpha, beta, rc, preview, devel or snapshot.
For example:
install-php-extensions xdebug-beta
TIP: When the latest version available on PECL is not stable, and you want to keep the last stable version,
force it by suffixing the extension's name with the stable state.
For example:
install-php-extensions mongodb-stable
Installing an extension from its source code
You can also install PHP extensions from source code (provided that it comes with a package.xml or a package2.xml file).
Accepted formats are:
- A short version for repositories hosted on GitHub.
For example, for the php-memcached-dev/php-memcached GitHub repository, you can simply write:# Install from a specific commit (full commit SHA-1) install-php-extensions php-memcached-dev/php-memcached@8f106564e6bb005ca6100b12ccc89000daafa9d8 # Install from a specific commit (short commit SHA-1) install-php-extensions php-memcached-dev/php-memcached@8f106564e6bb # Install from tag v3.2.0RC2 install-php-extensions php-memcached-dev/[email protected] install-php-extensions php-memcached-dev/php-memcached@refs/tags/v3.2.0RC2 # Install from branch master install-php-extensions php-memcached-dev/php-memcached@master install-php-extensions php-memcached-dev/php-memcached@refs/heads/master - An URL providing an archive containing the source code.
Examples:# tgz archive for commit 8f106564e6bb005ca6100b12ccc89000daafa9d8 install-php-extensions https://codeload.github.com/php-memcached-dev/php-memcached/tar.gz/8f106564e6bb005ca6100b12ccc89000daafa9d8 # tgz archive for tag v3.1.5 install-php-extensions https://codeload.github.com/php-memcached-dev/php-memcached/tar.gz/refs/tags/v3.1.5 # tgz archive for branch master install-php-extensions https://codeload.github.com/php-memcached-dev/php-memcached/tar.gz/refs/heads/master - The absolute path of a local directory.
Examples:# Download the source code curl -o /tmp/source.tgz https://codeload.github.com/php-memcached-dev/php-memcached/tar.gz/refs/tags/v3.1.5 tar xzf /tmp/source.tgz -C /tmp install-php-extensions /tmp/php-memcached-3.1.5
Bundled extensions or not?
There are some extensions that are bundled in the PHP source code (for example, gd and zip).
Some of these extensions are also available on PECL and/or a source code repository.
By default, install-php-extensions installs the bundled version.
If instead you want to use a remote version:
- for using PECL: just append the stability to the package name. For example:
install-php-extensions zip-stable - for installing from source code: use the syntax specified above. For example:
install-php-extensions php/pecl-database-oci8@7aa1061
install-php-extensions supports installing remote versions instead of bundled ones for these extensions:
- pdo_oci
- oci8
- zip
Installing composer
You can also install composer, and you also can specify a major version of it, or a full version.
Examples:
# Install the latest version
install-php-extensions @composer
# Install the latest 1.x version
install-php-extensions @composer-1
# Install a specific version
install-php-extensions @composer-2.0.2
Issue with Let's Encrypt certificates
The root CA certificate of Let's Encrypt changes (more details here).
That breaks old linux distributions, namely:
- Debian Jessie (8)
- Debian Stretch (9)
- Alpine Linux 3.7
- Alpine Linux 3.8
This script can fix this issue: simply pass @fix_letsencrypt as an argument:
install-php-extensions @fix_letsencrypt
Supported PHP extensions
| Extension | PHP 8.5 | PHP 8.4 | PHP 8.3 | PHP 8.2 | PHP 8.1 | PHP 8.0 | PHP 7.4 | PHP 7.3 | PHP 7.2 | PHP 7.1 | PHP 7.0 | PHP 5.6 | PHP 5.5 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| amqp | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| apcu | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| apcu_bc | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||||
| ast | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| bcmath | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| bitset | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| blackfire | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| brotli | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| bz2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| calendar | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| cassandra* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
| cmark | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||||
| csv | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||
| dba | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| ddtrace* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| decimal | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| ds | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| ecma_intl* | ✓ | ✓ | |||||||||||
| enchant | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| ev | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| event | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| excimer | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| exif | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| ffi | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| ftp | ✓ | ✓ | ✓ | ✓ | |||||||||
| gd | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| gearman | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| geoip | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| geos* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| geospatial | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| gettext | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| gmagick | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| gmp | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| gnupg | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| grpc | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| http | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| igbinary | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| imagick | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| imap | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| inotify | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| interbase | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| intl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| ion | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||||
| ioncube_loader | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| ip2location | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| jsmin | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| json_post | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| jsonpath | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| judy* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| ldap | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| luasandbox | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| lz4* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| lzf | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| mailparse | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| maxminddb | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
| mcrypt | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| md4c | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| memcache | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| memcached | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| memprof* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| mongo | ✓ | ✓ | |||||||||||
| mongodb | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| mosquitto | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| msgpack | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| mssql | ✓ | ✓ | |||||||||||
| mysql | ✓ | ✓ | |||||||||||
| mysqli | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| newrelic | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| nsq | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| oauth | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| oci8 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| odbc | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| opcache | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| opencensus | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
| openswoole | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
| opentelemetry | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| operator | ✓ | ✓ | ✓ | ✓ | |||||||||
| parallel* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| parle* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| pcntl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| pcov | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| pdo_dblib | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| pdo_firebird | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| pdo_mysql | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| pdo_oci | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| pdo_odbc | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| pdo_pgsql | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| pdo_snowflake* | ✓ | ✓ | ✓ | ✓ | |||||||||
| pdo_sqlsrv | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| pgsql | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| phalcon | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
| php_trie | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| phpy* | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||||
| pkcs11 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| pq | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| propro | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| protobuf | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| pspell | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| psr | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| pthreads* | ✓ | ✓ | ✓ | ||||||||||
| raphf | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| rdkafka | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| recode | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| redis | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| relay | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| rrd | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| saxon* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| seasclick* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| seaslog | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| shmop | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| simdjson* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| smbclient | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| snappy | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| snmp | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| snuffleupagus | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| soap | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| sockets | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| sodium* | ✓ | ✓ | ✓ | ||||||||||
| solr | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| sourceguardian | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| spx | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| sqlsrv* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| ssh2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| statgrab* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| stomp | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| swoole | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| sybase_ct | ✓ | ✓ | |||||||||||
| sync | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| sysvmsg | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| sysvsem | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| sysvshm | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| tensor | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| tideways | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| tidy | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| timezonedb | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| translit | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| uopz | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| uploadprogress | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| uuid | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| uv | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| v8js* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| vips* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| vld | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| wddx | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| wikidiff2* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| xattr | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| xdebug | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| xdiff | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| xhprof | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| xlswriter | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| xmldiff | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| xmlrpc | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| xpass* | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||
| xsl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| yac | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| yaml | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| yar | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| zephir_parser | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| zip | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| zmq | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| zookeeper | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| zstd | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Number of supported extensions: 162
PS: the pre-installed PHP extensions are excluded from this list.
You can list them with the following command (change php:8.5-cli to reflect the PHP version you are interested in):
$ docker run --rm php:8.5-cli php -m
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
hash
iconv
json
lexbor
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
random
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
uri
xml
xmlreader
xmlwriter
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
Configuration
You can configure the behavior of the script, as well as fine-tune some extensions in order fit your needs, by using environment variables.
Here's an example:
IPE_LZF_BETTERCOMPRESSION=1 install-php-extensions lzf
Here's the list of all the supported environment variables:
| Extension | Environment variable | Description |
|---|---|---|
IPE_DEBUG=1 | By setting this environment variable, the script will print all the commands it executes (it will be very verbose, useful only for debug purposes) | |
IPE_INSECURE=1 | By setting this environment variable, HTTPS certificate validation is disabled for network operations performed by the program | |
IPE_SAVE_PERMDEPS_TO=pathIPE_SAVE_VOLDEPS_TO=path | By setting this environment variable, the script will store in the path specified the list of APT/APK packages required by the installed PHP extensions (IPE_SAVE_PERMDEPS_TO) and/or the packages required to build the PHP extensions (IPE_SAVE_VOLDEPS_TO).Please remark that install-php-extension may configure the system in other ways (example) | |
IPE_PROCESSOR_COUNT | By default all available processors. Set this environment variable to override the number of processors detected by the script (used for parallel compilation) | |
IPE_DONT_ENABLE=1 | By default the script will install and enable the extensions. If you want to only install them (without enabling them) you can set this environment variable. To enable the extensions at a later time you can execute the command docker-php-ext-enable-<extension> (for example: docker-php-ext-enable-xdebug).Beware: installing some PHP extensions requires that other PHP extensions are already enabled, so use this feature wisely. | |
IPE_SKIP_CHECK=1 | By default the script will check if the extensions can be enabled: if you want to skip this check, you can use this flag. Beware: extensions may be enabled even if they break PHP: use this function wisely. | |
IPE_NOSTRIP=1 | By setting this environment variable, compiled PHP extensions will retain their debug symbols (useful for debugging of crashes like segmentation faults) | |
IPE_KEEP_SYSPKG_CACHE=1 | By default the script will clear the apt/apk/pear cache in order to save disk space. You can disable it by setting this environment variable | |
| lzf | IPE_LZF_BETTERCOMPRESSION=1 | By default install-php-extensions compiles the lzf extension to prefer speed over size; you can use this environment variable to compile it preferring size over speed |
| event | IPE_EVENT_NAMESPACE=... | By default, the event classes are defined in the root namespace. You can use this environment variable to specify a custom namespace |
| gd | IPE_GD_WITHOUTAVIF=1 | Since PHP 8.1, gd supports the AVIF format. Enabling it requires compiling libaom/libdav1d/libyuv/libavif on Debian up to 11 and Alpine up to 3.14, which is time-consuming. You can disable AVIF support by setting this environment variable on those operating system versions |
| oci8 & pdo_oci | IPE_INSTANTCLIENT_BASIC=1 | The oci8 and pdo_oci PHP extensions require Oracle Instant Client. In order to save disk space, we install the Basic Lite version: if you want to install the Basic (non-lite) version simply set this environment variable |
| http, intl, mongodb | IPE_ICU_EN_ONLY=1 | Some extensions require the ICU library, use this flag to install a smaller, but English-only, ICU library on Alpine 3.16 and later |
| pspell | IPE_ASPELL_LANGUAGES='...' | Configure the languages to be made available (for example: IPE_ASPELL_LANGUAGES='en fr'). If omitted, we'll assume en |
IPE_DEB_ARCHIVE & IPE_DEB_ARCHIVE_SECURITY | The APT packages of very old Debian versions (eg Jessie) may have been archived: you can use these environment variables to specify custom URLs of these APT archives | |
| newrelic | IPE_NEWRELIC_DAEMON=1 | Install the NewRelic daemon |
| newrelic | IPE_NEWRELIC_KEEPLOG=1 | Keep the log files of NewRelic setup (/tmp/nrinstall-….tar) |
| newrelic | NR_INSTALL_KEY | Your New Relic license key |
| ddtrace | IPE_DD_APPSEC=1 | Also enable the Datadog Application Security Monitoring module (ddappsec). Requires PHP 7.0+ and the 1.x tracer line |
| ddtrace | IPE_DD_PROFILING=1 | Also enable the Datadog Continuous Profiler module (datadog-profiling). Requires PHP 7.1+, Alpine 3.13+ (or any Debian) and the 1.x tracer line |
| swoole | IPE_SWOOLE_WITHOUT_IOURING=1 | The io_uring kernel functionality is considered unsafe by security experts (see here and here). By default Swoole 6 and later is configured with io_uring support, use this environment variable to skip configuring io_uring |
| saxon | IPE_SAXON_EDITION=EE | The Saxon edition to be used: EE for Enterprise Edition (default), PE for Professional Edition, HE for Home Edition |
Special requirements
Some extensions have special requirements:
| Extension | Requirements |
|---|---|
| cassandra | • Not available in jessie docker images• Not available in stretch docker images• Not available in buster docker images• Not available in bullseye docker images• Not available in bookworm docker images• Not available in trixie docker images |
| ddtrace | Not available in jessie docker images |
| ecma_intl | • Not available in buster docker images• Not available in bullseye docker images• Not available in trixie docker images• Not available in alpine3.22 docker images• Not available in alpine3.23 docker images• Not available in alpine3.24 docker images |
| geos | • Not available in alpine3.9 docker images• Not available in alpine3.10 docker images |
| judy | • Not available in alpine3.13 docker images• Not available in alpine3.14 docker images• Not available in alpine3.15 docker images |
| lz4 | Not available in jessie docker images |
| memprof | • Not available in alpine3.9 docker images• Not available in alpine3.10 docker images• Not available in alpine3.11 docker images• Not available in alpine3.12 docker images• Not available in alpine3.13 docker images• Not available in alpine3.14 docker images• Not available in alpine3.15 docker images |
| parallel | Requires images with PHP compiled with thread-safety enabled (zts) |
| parle | Not available in jessie docker images |
| pdo_snowflake | Not available in alpine docker images |
| phpy | Not available in buster docker images |
| pthreads | Requires images with PHP compiled with thread-safety enabled (zts) |
| saxon | • Not available in alpine3.7 docker images• Not available in alpine3.8 docker images• Not available in alpine3.9 docker images• Not available in alpine3.10 docker images• Not available in alpine3.11 docker images• Not available in 7.2-alpine docker images• Not available in 7.3-alpine docker images• Not available in 7.4-alpine docker images |
| seasclick | • Not available in alpine3.23 docker images• Not available in alpine3.24 docker images |
| simdjson | • Not available in jessie docker images• Not available in stretch docker images |
| sodium | Not available in jessie docker images |
| sqlsrv | • Not available in 7.1-alpine3.9 docker images• Not available in 7.1-alpine3.10 docker images |
| statgrab | • Not available in alpine3.12 docker images• Not available in alpine3.13 docker images• Not available in alpine3.14 docker images• Not available in alpine3.15 docker images• Not available in alpine3.16 docker images |
| v8js | • Not available in buster docker images• Not available in bullseye docker images• Not available in alpine3.12 docker images• Not available in alpine3.13 docker images• Not available in alpine3.14 docker images• Not available in alpine3.15 docker images• Not available in alpine3.16 docker images• Not available in alpine3.17 docker images• Not available in alpine3.18 docker images |
| vips | • Not available in alpine3.9 docker images• Not available in jessie docker images |
| wikidiff2 | • Not available in jessie docker images• Not available in stretch docker images |
| xpass | Not available in buster docker images |
How do I know which Linux distribution I am using?
You can run this command:
cat /etc/os-release
For example:
- for Debian 11 (Bullseye) you'll see:
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" - for Alpine Linux 3.14 you'll see:
PRETTY_NAME="Alpine Linux v3.14"
Tests
When submitting a pull request, a GitHub Action is executed to check if affected PHP extensions actually work (see below).
Furthermore, we also check that new versions of extensions in the PECL repository will still work.
This is done on a scheduled basis with another GitHub Action.
In case of failure, a message is sent to a Telegram Channel.
Feel free to subscribe to it to receive failure notifications.
How to contribute
See the CONTIBUTING.md file.
For the maintainers
See the MAINTAINERS.md file.
Do you want to really say thank you?
You can offer me a monthly coffee or a one-time coffee :wink:
Related repositories
#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
DevOps Exercises is a GitHub repository collecting 2624 questions and exercises spanning Linux, networking, Kubernetes, Terraform, and cloud platforms, written as plain markdown Q&A with no app or course wrapped around it.
Your own personal AI assistant. Any OS. Any Platform. The lobster way. 🦞
The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Quick answers
How active is development on mlocati/docker-php-extension-installer?
The most recent commit recorded on mlocati/docker-php-extension-installer was 12 days ago, based on the GitHub push timestamp. The repository has 435 forks — one of the better signals of community interest.
How does mlocati/docker-php-extension-installer compare to other Developer Tools projects?
mlocati/docker-php-extension-installer is tracked by TopGit in the Developer Tools category, with 5.0k GitHub stars and written in Shell. Browse the Developer Tools topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does mlocati/docker-php-extension-installer have?
mlocati/docker-php-extension-installer has 5.0k GitHub stars — refresh the page for the live number, or check github.com/mlocati/docker-php-extension-installer. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is mlocati/docker-php-extension-installer open source?
Yes — mlocati/docker-php-extension-installer ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/mlocati/docker-php-extension-installer.
What is mlocati/docker-php-extension-installer?
mlocati/docker-php-extension-installer (mlocati/docker-php-extension-installer) is a Shell project on GitHub. From the project's own README: Easily install PHP extensions in Docker containers
Where do I read more about mlocati/docker-php-extension-installer?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/mlocati/docker-php-extension-installer is the definitive source.
Read full README in the tab above.
Curious whether docker-php-extension-installer is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about docker-php-extension-installer.