"docker image build with php zip extension shows “bundled libzip is deprecated” warning" Code Answer

5

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
By s5s on August 8 2022

Answers related to “docker image build with php zip extension shows “bundled libzip is deprecated” warning”

Only authorized users can answer the Search term. Please sign in first, or register a free account.