尝试更新 Yii2 中的作曲家

Trying to update composer in Yii2

我想更新作曲家:

但我收到以下错误:

Problem 1
    - yiisoft/yii2-mongodb 2.0.4 requires ext-mongo >=1.5.0 -> the requested PHP extension mongo is missing from your system.
    - yiisoft/yii2-mongodb 2.0.3 requires ext-mongo >=1.5.0 -> the requested PHP extension mongo is missing from your system.
    - yiisoft/yii2-mongodb 2.0.2 requires ext-mongo >=1.5.0 -> the requested PHP extension mongo is missing from your system.
    - yiisoft/yii2-mongodb 2.0.1 requires ext-mongo >=1.4.0 -> the requested PHP extension mongo is missing from your system.
    - yiisoft/yii2-mongodb 2.0.0 requires ext-mongo >=1.3.0 -> the requested PHP extension mongo is missing from your system.
    - Installation request for yiisoft/yii2-mongodb ~2.0.0 -> satisfiable by yiisoft/yii2-mongodb[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4].

这是我的 composer.json:

{
    "name": "yiisoft/yii2-app-advanced",
    "description": "Yii 2 Advanced Project Template",
    "keywords": ["yii2", "framework", "advanced", "project template"],
    "homepage": "http://www.yiiframework.com/",
    "type": "project",
    "license": "BSD-3-Clause",
    "support": {
        "issues": "https://github.com/yiisoft/yii2/issues?state=open",
        "forum": "http://www.yiiframework.com/forum/",
        "wiki": "http://www.yiiframework.com/wiki/",
        "irc": "irc://irc.freenode.net/yii",
        "source": "https://github.com/yiisoft/yii2"
    },
    "minimum-stability": "stable",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": ">=2.0.4",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-swiftmailer": "*",
        "yiisoft/yii2-imagine": "*",
        "2amigos/yii2-ckeditor-widget": "~1.0",
        "2amigos/yii2-tinymce-widget": "~1.1",
        "facebook/php-sdk-v4" : "~5.0",
        "yiisoft/yii2-mongodb": "~2.0.0"
    },
    "require-dev": {
        "yiisoft/yii2-codeception": "*",
        "yiisoft/yii2-debug": "*",
        "yiisoft/yii2-gii": "*",
        "yiisoft/yii2-faker": "*"
    },
    "config": {
        "process-timeout": 1800
    },
    "extra": {
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    }
}

我该如何解决这个问题?请帮忙

您必须为 php 安装扩展程序。参考这个:http://php.net/manual/ru/mongo.installation.php

这可能与您的 php.ini 缺少 mongo.so 扩展名有关。

即使您已经在浏览器中为 php 启用了它,作曲家也会为 cli 使用 php.ini不同php.ini 文件.

您可以通过以下方式找到它:

php --ini

会有这样的东西:

Loaded Configuration File:         /etc/php5/cli/php.ini

使用 sudo 编辑此文件:

sudo nano /etc/php5/cli/php.ini

并在那里完成扩展(最后一行应该没问题):

extension=mongo.so

重新启动 php 并重试 composer install

成功了,大功告成。如果没有,请尝试遵循 mongo install guide.

添加扩展程序

extension=mongo.so

归档/etc/php5/cli/php.ini

然后重启 php

sudo service apapche restart

然后重试安装 compose 命令