PHP error: “The zip extension and unzip command are both missing, skipping.”

前端 未结 13 771
被撕碎了的回忆
被撕碎了的回忆 2020-12-12 13:12

When I run a composer update I get this error message:

Loading composer repositories with package information
Updating dependencies (including r         


        
相关标签:
13条回答
  • 2020-12-12 13:50

    For servers with PHP 5.6

    sudo apt-get install zip unzip php5.6-zip
    
    0 讨论(0)
  • 2020-12-12 13:51

    On docker with image php:7.2-apache I just needed zip and unzip. No need for php-zip :

    apt-get install zip unzip

    or Dockerfile

    RUN ["apt-get", "update"]
    RUN ["apt-get", "install", "-y", "zip"]
    RUN ["apt-get", "install", "-y", "unzip"]
    
    0 讨论(0)
  • 2020-12-12 13:54

    Not to belabor the point, but if you are working in a Dockerfile, you would solve this particular issue with Composer by installing the unzip utility. Below is an example using the official PHP image to install unzip and the zip PHP extension for good measure.

    FROM php:7.4-apache
    
    # Install Composer
    COPY --from=composer /usr/bin/composer /usr/bin/composer
    
    # Install unzip utility and libs needed by zip PHP extension 
    RUN apt-get update && apt-get install -y \
        zlib1g-dev \
        libzip-dev \
        unzip
    RUN docker-php-ext-install zip
    

    This is a helpful GitHub issue where the above is lovingly lifted from.

    0 讨论(0)
  • 2020-12-12 13:54

    I'm Using Ubuntu and with the following command worked

    apt-get install --yes zip unzip

    0 讨论(0)
  • 2020-12-12 14:00

    For Debian Jessie (which is the current default for the PHP image on Docker Hub):

    apt-get install --yes zip unzip php-pclzip
    

    You can omit the --yes, but it's useful when you're RUN-ing it in a Dockerfile.

    0 讨论(0)
  • 2020-12-12 14:04

    The shortest command to fix it on Debian and Ubuntu (dependencies will be installed automatically):

    sudo apt install php-zip
    
    0 讨论(0)
提交回复
热议问题