Thinkphp 3.2.3安装mongodb扩展后报错:系统不支持:Mongo

首先我利用:

    pecl install mongodb
安装了扩展,并且引入了php.ini,
重启nginx后:

    echo phpinfo();

可以看到Mongodb扩展已经启用了
但是当实例化对象的时候却报错:

    系统不支持:Mongo
    错误位置

    FILE: /www/kf/ThinkPHP/Library/Think/Db/Driver/Mongo.class.php  LINE: 67
    
    TRACE
    #0 /www/kf/ThinkPHP/Library/Think/Db/Driver/Mongo.class.php(67): E('\xE7\xB3\xBB\xE7\xBB\x9F\xE4\xB8\x8D\xE6\x94\xAF\xE6\x8C\x81...')
    #1 /www/kf/ThinkPHP/Library/Think/Db.class.php(77): Think\Db\Driver\Mongo->__construct(Array)
    #2 /www/kf/ThinkPHP/Library/Think/Model.class.php(2885): Think\Db::getInstance(Array)
    #3 /www/kf/ThinkPHP/Library/Think/Model.class.php(193): Think\Model->db(0, 'DB_MONGO', true)
    #4 /www/kf/ThinkPHP/Common/functions.php(1241): Think\Model->__construct('ImUser', '', 'DB_MONGO')
    #5 /www/kf/Application/Home/Controller/MobileController.class.php(44): M('ImUser', '', 'DB_MONGO')
    #6 [internal function]: Home\Controller\MobileController->test()
    #7 /www/kf/ThinkPHP/Library/Think/App.class.php(345): ReflectionMethod->invoke(Object(Home\Controller\MobileController))
    #8 /www/kf/ThinkPHP/Library/Think/App.class.php(219): Think\App::invokeAction(Object(Home\Controller\MobileController), 'test')
    #9 /www/kf/ThinkPHP/Library/Think/App.class.php(407): Think\App::exec()
    #10 /www/kf/ThinkPHP/Library/Think/Think.class.php(239): Think\App::run()
    #11 /www/kf/ThinkPHP/ThinkPHP.php(193): Think\Think::start()
    #12 /www/kf/public_html/index.php(32): require('/www/kf/ThinkPH...')
    #13 {main}


之前一直怀疑是扩展版本有问题,然后使用
pecl upgrade mongodb
更新了最新版本,还是不行。
捣鼓了个多小时,终于找到原因:
是因为PHP5.X 的扩展名叫:mongo而不是mogodb!!!
我擦嘞,感觉被玩了一样,
于是:
pecl uninstall mongodb

pecl install mongo 
然后引入,重启nginx,最终成功解决,但是官方提示该扩展已经过期了,
不再维护,所以各位,珍重,最好还是把TP升级下吧。。
 

猜你喜欢

转载自blog.csdn.net/zhanqixuan22/article/details/88964435