Docker image build with PHP zip extension shows “bundled libzip is deprecated” warning

It looks like PHP no longer bundles libzip. You need to install it. You install zlib1g-dev, but instead install libzip-dev. This installs zlib1g-dev as a dependency and allows the configure script to detect that libzip is installed.

For PHP < 7.3, you then need to

docker-php-ext-configure zip --with-libzip

before performing the installation with

docker-php-ext-install zip

as the last warning indicates.

In short: change the relevant part of your Dockerfile to

For PHP < 7.3

#install some base extensions
RUN apt-get install -y \
        libzip-dev \
        zip \
  && docker-php-ext-configure zip --with-libzip \
  && docker-php-ext-install zip

For PHP >= 7.3

#install some base extensions
RUN apt-get install -y \
        libzip-dev \
        zip \
  && docker-php-ext-install zip

I have verified that this builds as expected.

 


 

In case you are not using the Docker PHP base image, things may be much easier. For example, for Alpine the following Dockerfile will get you PHP 7 with the zip extension installed.

FROM alpine:latest

RUN apk update && apk upgrade
RUN apk add php7 php7-zip composer

Leave a Comment