Php Mongodb安装

Php Mongodb安装,php,linux,mongodb,mongodb-query,mongodb-php,Php,Linux,Mongodb,Mongodb Query,Mongodb Php,Mongodb安装在linux CentOS服务器(ssh)中,步骤在此url中提及 已使用命令启动MongoDB服务器,状态为ok sudo service mongod start When connecting mongodb with PHP (Yii app), it shows error like this. include(MongoClient.php) [<a href='function.include'>function.include</a>

Mongodb安装在linux CentOS服务器(ssh)中,步骤在此url中提及

已使用命令启动MongoDB服务器,状态为ok

sudo service mongod start 

When connecting mongodb with PHP (Yii app), it shows error like this.
include(MongoClient.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

PHP code

<?php
   // connect to mongodb
   $m = new MongoClient();
   echo "Connection to database successfully";
   // select a database
   $db = $m->health;
   echo "Database mydb selected";
   $collection = $db->medical;
   echo "Collection selected succsessfully";

?>
sudo服务mongod启动
将mongodb与PHP(Yii应用程序)连接时,会显示如下错误。
include(MongoClient.php)[]:无法打开流:没有这样的文件或目录
PHP代码

Yii2
为mongodb连接提供类
yii\mongodb\Connection

检查下面的链接

Yii 2的MongoDb扩展


它将解决您的问题。

如果我的答案对您有效,请将其标记为正确,以帮助其他面临相同问题的人。很乐意帮忙。