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

Php 我无法使用Composer安装Laravel(缺少ext-zip扩展名),php,laravel,debian,laravel-6,Php,Laravel,Debian,Laravel 6,我试图在我的Debian 9终端上安装Laravel with Composer with 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

我试图在我的Debian 9终端上安装Laravel with Composer with

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

并编辑php.ini文件,取消对以下行的注释:

extension=php_zip.dll
extension="zip.so"
但是什么都不管用,我也有同样的错误…

  • 请确保在更改后重新启动Web服务器
  • php-m
    列出已编译的模块
  • 有一次(在plesk上)我碰巧发现,composer使用的php版本与使用
    php
    本身不同
  • 您可以尝试
    php composer.phar(它的位置)
    并检查结果
如果安装laravel在这里很重要 以下是一些可能的解决方案

  • composer创建项目laravel/laravel[dir]
  • git克隆https://github.com/laravel/laravel.git
    然后
    cd
    到那个目录,通常是laravel,所以
    cd-laravel
    然后
    composer安装

    • 我和你有同样的问题

      我可以看出,我做了这件事,没有拉上拉链

      php -m
      
      是的

      为了查看是否有可以安装的软件包,我找到了
      php-zip
      ,于是我安装了

      sudo apt install php-zip
      
      之后
      php-m
      在列表中显示
      zip

      然后我再次尝试了安装Laravel的命令

      composer global require laravel/installer
      

      它成功了。

      安装后是否尝试重新启动apache?我使用XAMPP安装了PHP,并使用/opt/lampp/XAMPP重新启动,但不起作用Laravelse的安装第二步是检查扩展是否真的安装了
      PHP-m
      在取消注释这两行时,您也可以使用grep
      PHP-m | grep-zip
      ,您已启用Windows和Unix扩展。。。您检查过给定的行了吗?第三步是检查composer是否使用实际的php版本,因为您可以尝试
      php composer.phar
      ,其中composer.phar是它的路径,我有一次使用了不同的php版本,因此,这也可能是重新启动Web服务器的原因之一?shell上的PHP不使用任何webserver@NicoHaase因为人们对远程环境了解不多,所以尝试一下是很有用的。我在终端上写下了我的答案,我不知道该怎么办。。。
      sudo apt install php-zip
      
      composer global require laravel/installer