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

前端 未结 13 769
被撕碎了的回忆
被撕碎了的回忆 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:41

    Depending on your flavour of Linux and PHP version these may vary.

    (sudo) yum install zip unzip php-zip
    (sudo) apt install zip unzip php-zip
    

    This is a very commonly asked question, you'll be able to find more useful info in the aether by searching <distro> php <version> zip extension.

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

    For older Ubuntu distros i.e 16.04, 14.04, 12.04 etc

    sudo apt-get install zip unzip php7.0-zip
    
    0 讨论(0)
  • 2020-12-12 13:42

    Actually composer nowadays seems to work without the zip command line command, so installing php-zip should be enough --- BUT it would display a warning:

    As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension. This may cause invalid reports of corrupted archives. Installing 'unzip' may remediate them.

    See also Is there a problem with using php-zip (composer warns about it)

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

    PHP-ZIP needs some dependancies or library missing, depends on the image from Dockerfile you need to install them first

    RUN set -eux \
       && apt-get update \
       && apt-get install -y libzip-dev zlib1g-dev \
       && docker-php-ext-install zip
    
    0 讨论(0)
  • 2020-12-12 13:49

    I had PHP7.2 on a Ubuntu 16.04 server and it solved my problem:

    sudo apt-get install zip unzip php-zip

    Update

    Tried this for Ubuntu 18.04 and worked as well.

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

    I got this error when I installed Laravel 5.5 on my digitalocean cloud server (Ubuntu 18.04 and PHP 7.2) and the following command fixed it.

    sudo apt install zip unzip php7.2-zip

    0 讨论(0)
提交回复
热议问题