dongzhanlian6289 2018-06-28 08:34
浏览 286

无法加载动态库'mongodb.so' - Debian 8,PHP 7.2

I have a VPS with Debian 8 OS and a DirectAdmin panel with PHP7.2

To use MongoDB PHP driver, I installed it with the command sudo pecl install mongodb.

After that installation, I added the driver extension to the php.ini file by this command:

echo "extension=mongodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||" 

But it seems that driver not installed! Because when I exec a PHP command, face this warning:

PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718/mongodb.so (/usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718/mongodb.so: cannot open shared object file: No such file or directory), /usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718/mongodb.so.so (/usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718/mongodb.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Everything is ok in my local (windows), I add the Non Thread Safe (NTS) driver extension to the extensions directory, and It's all!

What I did wrong? Is installation of MongoDB driver on the PHP of DirectAdmin different from installation on a normal PHP?

Update:

MongoDB is not in the result of phpinfo(); too!

  • 写回答

2条回答 默认 最新

  • donglu5728 2018-06-28 08:43
    关注

    Please make sure php extension dir is: /usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718/

    Check:

    php -i |grep extension_dir
    

    If not, there are two options to do it:

    1. modify extension_dir in php.ini to /usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718/
    2. echo "extension=/full_path_through_pecl_installed/mongodb.so" > php.ini
    评论

报告相同问题?

悬赏问题

  • ¥15 如何修改pca中的feature函数
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法