


Installing specific versions of an extensionįor example: install-php-extensions xdebug-2.9.7 In order to be sure the COPY instruction uses the very latest version, you can run: docker pull mlocati/php-extension-installer Warning: by using this method you may use an outdated version of the mlocati/php-extension-installer image. o /usr/local/bin/install-php-extensions \Ĭhmod +x /usr/local/bin/install-php-extensions & \Ĭopying the script from a Docker image FROM php:7.2-cliĬOPY -from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN chmod +x /usr/local/bin/install-php-extensions & \ With the first method you are sure you'll always get the very latest version of the script, with the second method the process is faster since you'll use a local image.įor example, here some Dockerfiles that install the GD and xdebug PHP extensions: Downloading the script on the fly With the Dockerfile FROM php:7.2-cli You have two ways to use this script within your Dockerfiles: you can download the script on the fly, or you can grab it from the mlocati/php-extension-installer Docker Hub image. 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
