【问题标题】:laravel Installation failed, deleting ./composer.jsonlaravel 安装失败,删除 ./composer.json
【发布时间】:2018-08-09 07:11:47
【问题描述】:

嗨在 Laravel 安装中 出现以下错误

user@user-System-Product-Name:/$ composer global require "laravel/installer"
Changed current directory to /home/user/.config/composer

Using version ^2.0 for laravel/installer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/installer v2.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - laravel/installer v2.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - Installation request for laravel/installer ^2.0 -> satisfiable by laravel/installer[v2.0.0, v2.0.1].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.1/cli/php.ini
    - /etc/php/7.1/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.1/cli/conf.d/10-opcache.ini
    - /etc/php/7.1/cli/conf.d/10-pdo.ini
    - /etc/php/7.1/cli/conf.d/20-calendar.ini
    - /etc/php/7.1/cli/conf.d/20-ctype.ini
    - /etc/php/7.1/cli/conf.d/20-exif.ini
    - /etc/php/7.1/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.1/cli/conf.d/20-ftp.ini
    - /etc/php/7.1/cli/conf.d/20-gettext.ini
    - /etc/php/7.1/cli/conf.d/20-iconv.ini
    - /etc/php/7.1/cli/conf.d/20-json.ini
    - /etc/php/7.1/cli/conf.d/20-mcrypt.ini
    - /etc/php/7.1/cli/conf.d/20-mysqli.ini
    - /etc/php/7.1/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.1/cli/conf.d/20-phar.ini
    - /etc/php/7.1/cli/conf.d/20-posix.ini
    - /etc/php/7.1/cli/conf.d/20-readline.ini
    - /etc/php/7.1/cli/conf.d/20-shmop.ini
    - /etc/php/7.1/cli/conf.d/20-sockets.ini
    - /etc/php/7.1/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.1/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.1/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.1/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.

Installation failed, deleting ./composer.json.

安装失败,正在删除 ./composer.json。 我正在使用最新的作曲家版本... php7 , mysql , apache2 已经安装

【问题讨论】:

  • 你已经安装了 php-zip 扩展
  • php zip 已安装。 PHP 警告:PHP 启动:无法加载动态库 '/usr/lib/php/20160303/zip.soy' - /usr/lib/php/20160303/zip.soy:无法打开共享对象文件:没有这样的文件或目录在第 0 行的未知中
  • 该消息清楚地表明未找到 ZIP 库。为什么文件扩展名是.soy?看起来你的 php.ini 中有错字

标签: laravel composer-php


【解决方案1】:

上面写着the requested PHP extension zip is missing from your system.

您必须启用或安装它。

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

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

【讨论】:

  • 它说php7.1-zip已经是最新版本(7.1.11-0ubuntu0.17.10.1)。
  • 请运行此命令:composer install -v,以便您找到缺少的扩展。
  • PHP 警告:PHP 启动:无法加载动态库 '/usr/lib/php/20160303/zip.soy' - /usr/lib/php/20160303/zip.soy:无法打开共享目标文件:第 0 行的 Unknown 中没有这样的文件或目录
【解决方案2】:

只需要扩展邮编:

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

【讨论】:

    【解决方案3】:

    如果你使用 php 7.3

    sudo apt-get install php7.3-curl
    

    或者如果您不确定版本,只需使用下面的代码

    sudo apt-get install php7.2-curl
    

    【讨论】:

      【解决方案4】:

      我之前在 php 之后安装 Composer。

      运行: sudo apt-get install php7.2-zip

      sudo apt-get install php7.2-curl

      【讨论】:

        【解决方案5】:

        唯一帮助我的是使用 Brew 将我的 PHP 更新到 7.4。

        brew install php@7.4
        

        没有其他东西对我有用。

        【讨论】:

          【解决方案6】:

          唯一对我有帮助的是安装 php-xml

          sudo apt-get install php-xml
          

          【讨论】:

          • 您的意思是其他答案中建议的其他选项对您不起作用?
          猜你喜欢
          • 2019-04-22
          • 2021-07-19
          • 2020-02-29
          • 2018-03-02
          • 1970-01-01
          • 2013-03-27
          • 1970-01-01
          • 2022-11-05
          • 2022-12-23
          相关资源
          最近更新 更多