php - 我无法使用 Composer 安装 Laravel(缺少 ext-zip 扩展名)

标签 php laravel debian laravel-6

我尝试在我的 Debian 9 终端上使用 Composer 安装 Laravel

composer global require laravel/installer

但我收到以下错误:
Using version ^3.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 v3.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - laravel/installer v3.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - Installation request for laravel/installer ^3.0 -> satisfiable by laravel/installer[v3.0.0, v3.0.1].

  To enable extensions, verify that they are enabled in your .ini files:
    - /opt/lampp/etc/php.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.

我尝试使用以下方法安装 PHP ext Zip 扩展:
apt-get install php7.4-zip


apt-get install php-zip

并编辑 php.ini 文件,取消注释以下行:
extension=php_zip.dll
extension="zip.so"

但没有任何效果,我有同样的错误......

最佳答案

  • 确保更改后重新启动网络服务器
  • php -m列出已编译的模块
  • 我曾经(在 plesk 上)发生过, Composer 使用的 php 版本与使用 php 不同。本身
  • 你可以试试php composer.phar(the location of that)并检查结果

  • 如果在这里安装 laravel 很重要

    这里有一些可能的解决方案
  • composer create-project laravel/laravel [dir]
  • git clone https://github.com/laravel/laravel.git然后 cd到那个目录,通常是 laravel,所以 cd laravel然后 composer install
  • 关于php - 我无法使用 Composer 安装 Laravel(缺少 ext-zip 扩展名),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59843410/

    相关文章:

    ssl - 使用虚拟主机在 apache 服务器上设置 ssl 证书

    php - 使用 Ajax 和 jQuery 通过 PHP 脚本登录用户,是否安全?

    php按预定义的顺序对数组进行排序

    java - 路线 [product.store] 未定义。 (查看: C:\xampp\htdocs\hijabrent\resources\views\product\create. blade.php)

    php - Laravel: Eloquent orderBy hasOne 关系列使用 with

    Laravel 表单验证

    php - Laravel 使用 Ajax 上传文件

    linux - 无法写入已安装(外部)HDD

    linux - 无法安装 apache dpkg 被中断

    php - 具有多个 div 的 Jquery UI 可拖动/可调整大小的容器