ubuntu php mongodb_ubuntu php mongodb 扩展安装 / 升级

* composer 安装 mongodb 时候出现版本提示:

```

Your requirements could not be resolved to an installable set of packages.

Problem 1

- mongodb/mongodb 1.4.1 requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb has the wrong version (1.1.5) installed.

- mongodb/mongodb 1.4.0 requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb has the wrong version (1.1.5) installed.

- mongodb/mongodb 1.3.2 requires ext-mongodb ^1.4.0 -> the requested PHP extension mongodb has the wrong version (1.1.5) installed.

- mongodb/mongodb 1.3.1 requires ext-mongodb ^1.4.0 -> the requested PHP extension mongodb has the wrong version (1.1.5) installed.

- mongodb/mongodb 1.3.0 requires ext-mongodb ^1.4.0 -> the requested PHP extension mongodb has the wrong version (1.1.5) installed.

- Installation request for mongodb/mongodb ^1.3 -> satisfiable by mongodb/mongodb[1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1].

查看 php 的mongodb 扩展: echo phpinfo();

更新扩展

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

apt-get install php7.0-mongodb

重启启动 apache

` sudo systemctl restart apache2.service `

重启后刷新 phpinfo 才看到 mongodb 的版本变化。

你可能感兴趣的:(ubuntu,php,mongodb)