Answer the question
In order to leave comments, you need to log in
Why is adding extensions to PHP so...difficult?
Newbie questions, but still. Here is a typical Dockerfile that I ended up with:
FROM php:7.3-fpm-alpine
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS git \
imagemagick \
imagemagick-dev \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
&& pecl install xdebug imagick \
&& docker-php-ext-enable xdebug \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install -j$(nproc) pdo_mysql intl json curl iconv \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd \
&& apk del -f .build-deps \
&& ln -sf "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
Answer the question
In order to leave comments, you need to log in
With such a hassle, sometimes you want to score on alpine, do FROM ubuntu and apt install php-xdebug php-mysql php-gdIf it suits your task better, then why not do it?
I did some assembly on alpine, and then it turned out that there is no pdo driver for working with mssql on alpine and is not planned. I had to redo everything to the familiar and supported by all ubuntu.
I understand that the question has already grown a meter beard, but nevertheless, maybe someone will accidentally google it and my three kopecks will help:
There is a community project - a script for automatically installing PHP extensions inside Docker images.
It downloads dependencies by itself, correctly configures extensions and cleans up unnecessary packages after installation, here:
https://github.com/mlocati/docker-php-extension-in...
you haven’t seen a ruby with java yet, there you would have had an apoplectic stroke)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question