附注我也试过:extension=/home/max/mongo/bin/mongo.so 但仍然得到同样的错误.我错过了什么吗?附加信息来自 phpinfo()PHP 版本 => 5.3.16MongoDB:mongodb-linux-i686-2.4.3操作系统:CentOS 5.2 版(最终版)请帮忙谢谢,我有 PHP 64 位,据 Farkie 说,我安装了 bongoDB 64 位.仍然出现错误但没有worng ELF": php -i |grep mongoPHP 警告:PHP 启动:无法加载动态库 '/home/max/mongo/bin/mongo' -/home/max/mongo/bin/mongo:无法在第 0 行的未知中动态加载可执行文件我在 /usr/lib64/php/modules/ 下没有看到 mongo.so 解决方案 你有一个 64 位的 mongo.so,但有一个 32 位版本的 PHP(或者反过来).I opened package and installed mongoDB and got:[root@feeder /]# cd /home/max/mongodb-linux-i686-2.4.3/bin[root@feeder bin]# ls -ltotal 231700-rwxr-xr-x 1 root root 17828204 Apr 23 00:01 bsondump-rwxr-xr-x 1 root root 9181648 Apr 23 00:04 mongo-rwxr-xr-x 1 root root 17882692 Apr 23 00:03 mongod-rwxr-xr-x 1 root root 17885740 Apr 22 23:56 mongodump-rwxr-xr-x 1 root root 17840780 Apr 22 23:57 mongoexport-rwxr-xr-x 1 root root 17883768 Apr 23 00:00 mongofiles-rwxr-xr-x 1 root root 17852780 Apr 22 23:58 mongoimport-rwxr-xr-x 1 root root 17832300 Apr 23 00:00 mongooplog-rwxr-xr-x 1 root root 17832876 Apr 23 00:02 mongoperf-rwxr-xr-x 1 root root 17890796 Apr 22 23:56 mongorestore-rwxr-xr-x 1 root root 13491532 Apr 23 00:03 mongos-rwxr-xr-x 1 root root 17795196 Apr 23 00:02 mongosniff-rwxr-xr-x 1 root root 17877452 Apr 22 23:58 mongostat-rwxr-xr-x 1 root root 17832268 Apr 22 23:59 mongotopAdded link: mongo -> mongodb-linux-i686-2.4.3Created data folder: mkdir /mongo/datainitiated mongo: mongo/bin/mongod --dbpath=mongo/dataAll works fine and can connect with mongoVUE monitor tool.So far so good.Now, I try to connect to BongoDB from PHP:I added to php.ini (nano /etc/php.ini): extension=/home/max/mongo/bin/mongoand restarted httpd: /etc/init.d/httpd restartfrom code: $conn = new Mongo('localhost');I get an error: PHP Warning: PHP Startup: Unable to load dynamic library '/home/max/mongo/bin/mongo' - /home/max/mongo/bin/mongo: wrong ELF class: ELFCLASS32 in Unknown on line 0PSI tried also: extension=/home/max/mongo/bin/mongo.so but still get the same error.Did I miss something?Additional Info from phpinfo()PHP Version => 5.3.16MongoDB: mongodb-linux-i686-2.4.3OS: CentOS release 5.2 (Final)Please, helpThanks,[EDIT]I have PHP 64 bit, according to Farkie, I installed bongoDB 64 bit. Still get error but without "worng ELF": php -i | grep mongo PHP Warning: PHP Startup: Unable to load dynamic library '/home/max/mongo/bin/mongo' - /home/max/mongo/bin/mongo: cannot dynamically load executable in Unknown on line 0I don't see mongo.so under /usr/lib64/php/modules/ 解决方案 You have a 64bit mongo.so, but a 32bit version of PHP (Or the other way round). 这篇关于仍然报错 Unable to load dynamic library '/home/max/mongo/bin/mongo'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-29 18:49