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

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命令,以便编写器可以下载依赖项?


当前回答

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

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

其他回答

请先检查你的作曲状态

composer diagnose 

如果状态显示

zip: extension not found, unzip not available, 7-Zip not available

then

打开XAMPP服务器 >点击“PHP(PHP .ini)” 找到“zip” extension = zip将显示 删除分号并保存文件 重新启动XAMPP Apache

Now

composer create-project laravel/laravel <<project_name>>

or

laravel new <<project_name>>

对于使用PHP 5.6的服务器

sudo apt-get install zip unzip php5.6-zip

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

sudo apt install php-zip

我正在使用Ubuntu,并使用以下命令工作

Apt-get install——yes zip unzip

实际上,现在的composer似乎不需要zip命令行命令就可以工作,所以安装php-zip应该就足够了——但是它会显示一个警告:

由于没有“unzip”命令,安装的zip文件正在使用 PHP压缩扩展。 这可能导致已损坏档案的无效报告。安装“unzip”可能 纠正他们。

参见使用php-zip是否有问题(作曲家对此发出警告)