Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding PHP zip extension in a Docker image

I am trying to install the Zip extension of my PHP container built from php:7.4-fpm-alpine

This is what I am using in my Dockerfile

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

But it is giving me this error:

configure: error: unrecognized options: --with-libzip ERROR: Service 'php' failed to build : The command '/bin/sh -c docker-php-ext-configure zip --with-libzip=/usr/include' returned a non-zero code: 1


1 Answers

The solution is as simple as removing the docker-php-ext-configure zip --with-libzip line entirely for PHP >= 7.4. Defaults are sufficient.

As commented by hackel on their issue tracker: https://github.com/laradock/laradock/issues/2421#issuecomment-567728540

So a working Dockerfile would be:

FROM php:7.4-fpm-alpine

RUN apk add --no-cache \
      libzip-dev \
      zip \
    && docker-php-ext-install zip
like image 110
β.εηοιτ.βε Avatar answered Oct 21 '25 16:10

β.εηοιτ.βε