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

Asked

Viewed 1,815 times

3

I’m taking the first steps with Docker, soon came the question, what is 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 didn’t understand the purpose of these. It wouldn’t be the same as using apt-get install Pdo pdo_mysql...?

  • I don’t know about PHP, but it is possible that these guys are utilities that are in the base image of PHP for easy installation and configuration of dependencies.

1 answer

3


These two commands are tools to facilitate the inclusion of PHP modules in Docker, They are part of all official PHP images and so standardize the installation of modules. https://hub.docker.com/_/php/

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

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

When executing the command 'Docker-php-ext-install bz2', a respective file is created in the PHP conf. d folder containing the line for its 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 image of the selected PHP.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.