致命错误:找不到类"MongoDB \ Driver \ Manager" [英] Fatal error: Class 'MongoDB\Driver\Manager' not found
问题描述
我想使用MongoDB驱动程序,但是当我使用它时,它抛出了一个错误:
I want to use the MongoDB Driver, but it throw me an error, when i use it:
$mongo = new MongoDB\Driver\Manager("mongodb://localhost:27017");
错误:
消息:找不到类'MongoDB \ Driver \ Manager'
Message: Class 'MongoDB\Driver\Manager' not found
当我使用php_info()检查它时,我看到有
When i check it with the php_info(), i see, there is
是否有使用驱动程序的要求?
Is there any requirement to use the driver?
推荐答案
Mongo扩展和MongoDB扩展之间存在一些混淆,这是不一样的.由于您的版本号,我想您使用的是已弃用的旧Mongo扩展.
There is some confusion between the Mongo extension and the MongoDB extension which are not the same. Because of your version number, I guess you are using the old Mongo extension that is deprecated.
请确保您安装了新的 MongoDB扩展,并且应该没问题. .不要忘记从php.ini中删除旧的extension=mongo.so
,因为这可能会引起问题.
Make sure that you install the new MongoDB extension and you should be fine. Don't forget to remove the old extension=mongo.so
from your php.ini since this could cause problems.
这篇关于致命错误:找不到类"MongoDB \ Driver \ Manager"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!