What is the real usefulness of docker-php-ext-configure and docker-php-ext-install?

2

I'm getting started with Docker, so the question came, what's the docker-php-ext-configure and docker-php-ext-install ?

Example:

RUN apt-get install -y libpq-dev libsqlite3-dev
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql
RUN docker-php-ext-install pdo pdo_mysql pgsql pdo_pgsql pdo_sqlite

I do not understand what the purpose of these is. Would not it be the same as using apt-get install pdo pdo_mysql ...?

    
asked by anonymous 06.10.2017 / 21:16

1 answer

1

These two commands are tools to make it easier to include PHP modules in docker. They are part of all official PHP images and therefore standardize the installation of the modules. link

When installing a PHP module, it is necessary to perform a set of procedures that change depending on which module, PHP version, web server used, and previously installed packages.

For example, consider the bz2 module in PHP7.2 on Apache2 in Alpine Linux. To activate it is necessary that the line "extension = bz2.so" is in the PHP settings.

When you run the 'docker-php-ext-install bz2' command, a respective file is created in the PHP conf.d folder containing the line for your activation.

That is, it is not enough that the packages are installed for a module to work, PHP still needs small changes in the container that vary according to the selected PHP image.

    
23.01.2018 / 20:11