mongodb学习系列(四)
2017-08-30 本文已影响0人
gogocheng
开启安装php-mongodb拓展
首先,查看php当前版本,在此,我使用的是phpstudy这个集成环境,打开根目录下phpinfo.php查看当前php版本和相关配置,如下图所示:


然后根据自己当前的php版本来选择相应的扩展文件,访问该地https://github.com/mongodb/mongo-php-driver,下载相应的mongodb 的php 扩展:
下载好之后解压扩展文件放入ext拓展目录里,如下图所示:

接下来在php.ini开启或者添加mongodb的扩展

接着重启apache服务,在phpstudy中直接重启环境即可。如果不是集成环境就要在服务中重启apache。

最后,再到根目录下去查看phpinfo文件的输出:

如果出现以上扩展,就说明mongodb的php扩展配置成功。我们就可以使用php去操作mongodb了。