当前位置: 首页>>技术教程>>正文


php – 无法通过Composer安装laravel安装程序

, , ,

问题描述

我正在尝试在Ubuntu PC上使用composer安装laravel安装程序,但是在安装过程中出现此错误。您的要求无法解决为一组可安装的软件包。

  Problem 1
    - laravel/installer v1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - laravel/installer v1.4.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - Installation request for laravel/installer ^1.4 -> satisfiable by laravel/installer[v1.4.0, v1.4.1].

  To enable extensions, verify that they are enabled in those .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
`

出现错误,然后我使用此注释:

composer global require "laravel/installer"

最佳答案

它说它需要zip扩展名

laravel/installer v1.4.0 requires ext-zip……..

安装与已安装的php版本相对应的版本:

# For php v7.0
sudo apt-get install php7.0-zip

# For php v7.1
sudo apt-get install php7.1-zip

# For php v7.2
sudo apt-get install php7.2-zip

# For php v7.3
sudo apt-get install php7.3-zip

# For php v7.4
sudo apt-get install php7.4-zip

次佳答案

在centos 7上,我使用了:

yum install php-pecl-zip

因为没有其他解决方案对我不起作用。

第三种答案

对于PHP7.1,请安装此

sudo apt-get install php7.1-zip

第四种答案

使用PHP7.2的Centos 7:

sudo yum --enablerepo=remi-php72 install php-pecl-zip

第五种答案

对于Ubuntu 16.04,我已将此命令用于PHP7.2,它对我有用。

sudo apt-get install php7.2-zip

第六种答案

适用于CATALINA的MAC用户

首先,安装自制软件。然后说

brew install php@7.3
brew link php@7.3

重新启动控制台并运行laravel安装程序

第七种答案

跑:

brew install php@7.3
brew link php@7.3 --force

其次是:

composer global require "laravel/installer"

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/9121.html,未经允许,请勿转载。