简体   繁体   中英

MongoDB PHP Driver and MongoDB compatibility check

In PHP how to check if the CORRECT mongodb PHP driver is installed for the corresponding 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

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

echo extension_loaded("mongo") ? "loaded\\n" : "not loaded\\n";

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

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM