Reputation:
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
Upvotes: 4
Views: 12884
Reputation: 1
Try this if using php:7.4-fpm
FROM php:7.4-fpm
# Install system dependencies
RUN apt-get update && apt-get install -y zip
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-configure zip \
&& docker-php-ext-install zip
Upvotes: 0
Reputation: 11
Try this
FROM composer AS composer
COPY . /app
RUN rm composer.lock && composer install \
--optimize-autoloader \
--no-interaction \
--no-progress \
--ignore-platform-reqs
RUN apk add --no-cache php \
php7-common \
php7-fpm \
php7-pdo \
php7-opcache \
php7-zip \
Upvotes: 0
Reputation: 39069
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
Upvotes: 17