gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 23:09:12 25 4
gpt4 key购买 nike

我尝试在我的 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/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com