首页 > 解决方案 > 作曲家安装在 phpstorm 中不起作用

问题描述

我从 github 克隆了一个 laravel 存储库。我想在 phpstorm 上安装它,但是当我composer install在终端环境中运行这个命令时,出现了这个错误:

Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpunit/phpunit 5.7.9 requires ext-dom * -> the requested PHP    
      ...
    - phpunit/phpunit 5.2.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - Installation request for phpunit/phpunit ^5.2 -> satisfiable by phpunit/phpunit[5..., 5.7.7, 5.7.8, 5.7.9].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.0/cli/php.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.json 文件:

{
    "name": "cydrobolt/polr",
    "description": "The Polr URL Shortener.",
    "keywords": ["url-shortener", "url", "cms"],
    "require": {
        "php": ">=5.5.9",
        "laravel/lumen-framework": "5.1.*",
        "vlucas/phpdotenv": "~1.0",
        "illuminate/mail": "~5.1",
        "google/recaptcha": "~1.1"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.0",
        "phpunit/phpunit": "^5.2",
        "symfony/css-selector": "^3.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/"
        ]
    },
    "autoload-dev": {
        "classmap": [
            "tests/"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

我尝试了这个解决方案,但它不起作用。问题是什么?

标签: phpcomposer-php

解决方案


您的 php.ini 设置中缺少扩展名。安装 ext-dom 的扩展,然后重新加载/重新启动服务器并再次运行“composer install”。

如果您使用带有 apt-get 的 Linux,那么您可以使用以下命令安装 ext-dom:

sudo apt-get install php-xml

推荐阅读