thecodingmachine / docker-images-php

A set of PHP Docker images
MIT License
785 stars 138 forks source link

How to install and enable all possible PHP extensions #314

Closed guoard closed 2 years ago

guoard commented 2 years ago

Hi, Thank you for your awesome Dockerfiles.

How can I install and enable all PHP extensions which are available in extensions directory for every php version with thecodingmachine/php:${PHP_VERSION}-v4-slim-apache image.

Does this Dockerfile do the job?

FROM thecodingmachine/php:${PHP_VERSION}-v4-slim-apache

USER root
RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./install_all.sh

Or do it like this?


FROM thecodingmachine/php:7.2-v4-slim-apache

USER root
RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./install_all.sh && ./disable_all.sh

ENV PHP_EXTENSIONS="amqp apcu ast bcmath blackfire bz2 dba ds enchant ev event gd gmp gnupg grpc igbinary imagick imap intl ldap mailparse mcrypt memcached mongodb msgpack mysqli pcov pdo_mysql pdo_pgsql pdo_sqlite pgsql pspell rdkafka redis snmp soap sqlite3 swoole tidy uploadprogress uuid weakref xdebug xmlrpc yaml"
mistraloz commented 2 years ago

You should do like that :

ARG  PHP_EXTENSIONS="amqp apcu ast bcmath blackfire bz2 dba ds enchant ev event gd gmp gnupg grpc igbinary imagick imap intl ldap mailparse mcrypt memcached mongodb msgpack mysqli pcov pdo_mysql pdo_pgsql pdo_sqlite pgsql pspell rdkafka redis snmp soap sqlite3 swoole tidy uploadprogress uuid weakref xdebug xmlrpc yaml"
FROM thecodingmachine/php:7.2-v4-slim-apache
ENV PHP_EXTENSIONS="${PHP_EXTENSIONS}"

/!\ ARG should be before the first "FROM" instruction of the Dockerfile file.