Search code examples
phpdockerxdebugpecl

Docker PHP ext enable command failing


What is required to have docker-php-ext-... commands available? I am creating an Alpine image

FROM alpine:3.12

RUN apk update && \
    # Add support for PHP7.4.
    apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
    php php7-fpm nginx composer git 
    ....

# PHPIZE dependencies + xdebug
RUN apk add --no-cache autoconf file g++ gcc libc-dev make pkgconf re2c \
    php7-pecl-xdebug \
    && docker-php-ext-install xdebug

...

But I am getting /bin/sh: docker-php-ext-install: not found.

How can I run the command? Also, can apk add php7-pecl-xdebug replace installing pecl as a dependency and requiring the extension that way?


Solution

  • You are using vanilla alpine image. docker-php-ext-* commands exist only in php-alpine image

    For example, replace your FROM to something like:

    FROM php:7.4-fpm-alpine