Php: Cannot install ext-zip on php:7.3-alpine

Created on 12 Feb 2019  路  6Comments  路  Source: docker-library/php

This simple Dockerfile fails to build, with or without the configure step in the middle:

FROM php:7.3-alpine3.8

RUN apk add --no-cache zip zlib-dev
RUN docker-php-ext-configure zip --with-zlib-dir=/usr/include
RUN docker-php-ext-install zip

Most helpful comment

FTR, you need libzip-dev instead of zlib-dev in Alpine 3.8. Hence, the docker-php-ext-install zip command is requiring the wrong dependency to work alone.

All 6 comments

FTR, you need libzip-dev instead of zlib-dev in Alpine 3.8. Hence, the docker-php-ext-install zip command is requiring the wrong dependency to work alone.

Thanks! Glad you found the solution.

I had to use docker-php-ext-configure zip --with-libzip * instead of.

This is the full command

bash RUN apk add --no-cache libzip-dev && docker-php-ext-configure zip --with-libzip=/usr/include && docker-php-ext-install zip

I use this Dockerfile to build my php container :

FROM php:7.1-alpine3.8

RUN apk add --no-cache zip zlib-dev
RUN docker-php-ext-configure gd zip \
        --with-zlib-dir=/usr/include \
        --with-freetype-dir=/usr/include/  \
        --with-jpeg-dir=/usr/include/

RUN docker-php-ext-install zip

But docker-php-ext-configure gd zip was get a error :
checking host system type... Invalid configuration `zip': machine `zip' not recognized configure: error: /bin/sh ./config.sub zip failed

So i change my Dockerfile like this :

RUN docker-php-ext-configure gd \
    --with-freetype-dir=/usr/include/ \
    --with-jpeg-dir=/usr/include/

RUN docker-php-ext-configure zip \
     --with-libzip=/usr/include

It is working!
But why?

These sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow.

Was this page helpful?
0 / 5 - 0 ratings