Php: missing ZIP extension causes double download in composer

Created on 5 Jan 2015  Â·  11Comments  Â·  Source: docker-library/php

I'm wary of php enought not to know wheter this is #8 but the ZIP extension seems missing.

I'm using composer and it fetches stuff like

  • Installing phpunit/phpunit (3.7.31)
    Downloading: 100%
    Failed to download phpunit/phpunit from dist: Could not decompress the archive, enable the PHP zip extension.
    A php.ini file does not exist. You will have to create one.
    Now trying to download from source

    • Installing phpunit/phpunit (3.7.31)

      Cloning d24e9877331039582497052cc3c4d9f465b88210

Guessing from execution times it does download twice.

Most helpful comment

That sounds like it needs a docker-php-ext-install zip:

FROM php:5.6
RUN apt-get update && apt-get install -y zlib1g-dev \
    && docker-php-ext-install zip

All 11 comments

That sounds like it needs a docker-php-ext-install zip:

FROM php:5.6
RUN apt-get update && apt-get install -y zlib1g-dev \
    && docker-php-ext-install zip

Takes considerable time but since it saves downloading git too it seems a net win. Thanks!

@tianon for me docker-php-ext-install zip suits okay, without zlib1g-dev – can you explain its necessity?

@Aliance The php zip extension requires zlib wich is a data-compression library. That's why you have to install zlib1g-deb first.

@tianon i don't get why your solution doesn't work for me. maybe because of php version? i have 7.1

checking for the location of zlib... configure: error: zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB

@yuklia, I am unable to reproduce. Using php:7.1, I only get that error if I run docker-php-ext-install zip without first installing zlib1g-dev. 😕

For one whole want to find an alternative solution with zlib: use bitnami/php-fpm (or can learn from that docker file where zlib extension installed well).

for php:7.3-apache, this is what I had to do:

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --fix-missing \
    apt-utils \
    gnupg

RUN echo "deb http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list
RUN echo "deb-src http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list
RUN curl -sS --insecure https://www.dotdeb.org/dotdeb.gpg | apt-key add -

RUN apt-get update && apt-get install -y \
    zlib1g-dev \
    libzip-dev
RUN docker-php-ext-install zip

For php:7-3 only lib-zip-dev seems to be required:

docker run --rm -it php:7.3 sh -c "apt-get update && apt-get install -y libzip-dev && docker-php-ext-install zip"

That sounds like it needs a docker-php-ext-install zip (its working for me)

for me php:7-4 this one work docker-php-ext-install zip with RUN apt-get install libzip-dev

Was this page helpful?
0 / 5 - 0 ratings