
alpha, beta, rc, preview, devel or snapshot.įor example: install-php-extensions xdebug-beta Pre-release versions extensions available on PECL can be setup by suffixing the extension's name with its state i.e. # Install the most recent xdebug 2.8.x version (for example 2.8.1) The script also supports resolving compatible versions by prefixing the version with a caret ( ^).įor example: # Install the most recent xdebug 2.x version (for example 2.9.8) Installing specific versions of an extensionįor example: install-php-extensions xdebug-2.9.7 You may want to run docker pull mlocati/php-extension-installer in order to use an up-to-date version. Using the script of a Docker image RUN -mount = type =bind,from =mlocati/php-extension-installer:1.5,source =/usr/bin/install-php-extensions,target =/usr/local/bin/install-php-extensions \ Warning: by using this method you may use an outdated version of the mlocati/php-extension-installer image. Gd xdebug Copying the script from a Docker image FROM php:7.2-cli COPY -from =mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions gd xdebug Install-php-extensions gd xdebug Direct execution with curl FROM php:8.2-cli RUN curl -sSL -o - | sh -s \ o /usr/local/bin/install-php-extensions \Ĭhmod +x /usr/local/bin/install-php-extensions & \ Install-php-extensions gd xdebug Downloading the script on the fly with curl FROM php:7.2-cli RUN curl -sSLf \


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 /usr/local/bin/ RUN chmod +x /usr/local/bin/install-php-extensions & \ You have many ways to use this script within your Dockerfiles. See also the notes in the Special requirements section.

Supported docker images are all the Alpine/Debian versions, except for PHP 5.5 where we only support Debian 8 (jessie) (that is, php:5.5, php:5.5-apache, php:5.5-cli, php:5.5-fpm, php:5.5-zts). 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. This repository contains a script that can be used to easily install a PHP extension inside the official PHP Docker images. Easy installation of PHP extensions in official PHP Docker images
