MongoDB PHP 驱动程序和 MongoDB 兼容性检查 [英] MongoDB PHP Driver and MongoDB compatibility check

查看:37
本文介绍了MongoDB PHP 驱动程序和 MongoDB 兼容性检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP中如何检查是否为相应的mongodb安装了正确的mongodb PHP驱动.

In PHP how to check if the CORRECT mongodb PHP driver is installed for the corresponding mongodb.

下面的链接说明如何检查是否安装了 mongodb PHP 驱动程序,但没有说明该驱动程序是否正确/与相应的 mongodb 兼容.

The link below tells how to check if mongodb PHP driver is installed, but does not tell if that driver is correct/compatible for the corresponding mongodb.

http://stackoverflow.com/questions/11134959/check-if-mongodb-php-driver-is-installed

http://stackoverflow.com/questions/11134959/check-if-mongodb-php-driver-is-installed

例如,如果我有 PHP 5.3.10 版和 mongodb 2.2.2,则命令

For example, if I have PHP version 5.3.10 and have mongodb 2.2.2, the command

echo extension_loaded("mongo") ?"加载\n" : "未加载\n";

会说已加载,但是 mongodb 无法正常工作,因为对于 mongodb 2.2.2,您需要最新的 PHP 而不是 5.3.10

will say loaded, however, mongodb is not going to work properly because for mongodb 2.2.2, you need the latest PHP not 5.3.10

推荐答案

我认为,您在谈论驱动程序,而不是 PHP 本身.PHP 没有内置支持访问 \Mongo* 类,直到您编译和加载特殊扩展.

I think, you're talking about driver, not PHP itself. PHP has no built-in support to access \Mongo* classes until you compile and load special extension.

既然您在谈论 MongoDB 的最新版本,我认为您无法使用其部分功能,因为您有一些旧驱动程序(例如 1.2.12).当您升级 PHP 时,您可能也将驱动程序更新到最新的 (1.3.0) 稳定版本.该版本的驱动程序是几天前提交的,它支持MongoDB提供的所有最新功能.

Since you're talking about the latest version of MongoDB, I think you couldn't use some parts of its functionality because you had some old driver (say, 1.2.12). When you upgraded PHP, you, probably, updated the driver to the latest (1.3.0) stable version as well. That version of driver was submitted a couple of days ago, and it supports all the latest features MongoDB provides.

无论如何,如果您想检查您拥有哪个版本的驱动程序,您可以从您的 PHP 中调用 phpinfo(8) 并查看 mongo 部分,显示驱动程序的版本.

Anyway, if you'd like to check which version of driver you have, you can call phpinfo(8) from your PHP and look though the output for the mongo section, where the version of driver is displayed.

这篇关于MongoDB PHP 驱动程序和 MongoDB 兼容性检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆