当我运行一个作曲器更新时,我得到这个错误消息:

Loading composer repositories with package information
Updating dependencies (including require-dev)
    Failed to download psr/log from dist: The zip extension and unzip command are both missing, skipping.
The php.ini used by your command-line PHP is: /etc/php/7.0/cli/php.ini
    Now trying to download from source

我需要做什么才能启用zip和unzip命令,以便编写器可以下载依赖项?


当前回答

对于Debian Jessie(这是Docker Hub上PHP映像的当前默认):

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

你可以省略——是的,但当你在Dockerfile中运行它时,它很有用。

其他回答

安装zip 我正在运行一个docker容器,这帮助了我 Docker-compose exec app apt-get install zip

PHP-ZIP需要一些依赖项或库缺失,这取决于你需要先安装Dockerfile中的镜像

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

在Debian和Ubuntu上修复它的最短命令(依赖项将自动安装):

sudo apt install php-zip

根据您对Linux和PHP版本的喜好,这些可能会有所不同。

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

这是一个非常常见的问题,你可以通过搜索<distro> php <version> zip扩展名来找到更多有用的信息。

如果你使用Ubuntu和PHP 7.2,使用这个…

sudo apt-get update
sudo apt-get install zip unzip php7.2-zip