简体   繁体   English

在Ubuntu上安装带灯的Mongodb(Linux)

[英]Installing Mongodb with Lamp On Ubuntu ( Linux )

I followed the following steps to install mongo's php drivers with lampp. 我按照以下步骤安装mongo的php驱动程序与lampp。

http://abstract2paradox.wordpress.com/2012/01/26/adding-mongo-db-driver-to-xampp/ http://abstract2paradox.wordpress.com/2012/01/26/adding-mongo-db-driver-to-xampp/

When I start lampp its gives the following error 当我启动lampp时,它会出现以下错误

Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so: wrong ELF class: ELFCLASS64 in Unknown on line 0 警告:PHP启动:无法加载动态库'/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so' - / opt / lampp / lib / php / extensions / no- debug-non-zts-20090626 / mongo.so:错误的ELF类:第0行的未知ELFCLASS64

Any ideas? 有任何想法吗?

Thanking you 感谢您

This means that your PHP is compiled in 32-bit mode, but the mongo extension as 64-bit mode. 这意味着您的PHP以32位模式编译,但mongo扩展为64位模式。 I believe Apple's compiled PHP is in 32-bit mode as well, you can verify that with: 我相信Apple的编译PHP也是32位模式,您可以通过以下方式验证:

php -r 'echo PHP_INT_MAX, "\n";'

If that shows 如果那表明

9223372036854775807
you're on a 64-bit platform. 你是在64位平台上。

Now, in your case you will need to make sure that you compile the MongoDB extension with a 32-bit architecture. 现在,在您的情况下,您需要确保使用32位体系结构编译MongoDB扩展。 From http://artur.ejsmont.org/blog/content/how-to-build-mongodb-pecl-extension-in-32bit-for-php-52-on-macosx-snow-leaopard I believe you can do that with: 来自http://artur.ejsmont.org/blog/content/how-to-build-mongodb-pecl-extension-in-32bit-for-php-52-on-macosx-snow-leaopard我相信你能做到这一点有:

\npecl download mongo pecl下载mongo\ntar -xvzf mongo-1.2.7.tgz tar -xvzf mongo-1.2.7.tgz\ncd mongo-1.2.7 cd mongo-1.2.7\n\nCFLAGS="-m32" CFLAGS = “ -  M32”\n\nphpize phpize\n./configure 。/配置\nmake 使\nmake install make install\n

The problem was as is outlined by Derick above. 这个问题正如上面Derick概述的那样。 Although the way the problem got solved was download a 32 bit version of the ubuntu os and running it as a virtual machine on my pc using vmware. 虽然解决问题的方法是下载32位版本的ubuntu操作系统并使用vmware在我的电脑上将其作为虚拟机运行。 Later followed the 'Manual Installation section' on this page for the php driver installation and it all worked. 稍后按照本页面上的“手动安装部分”进行php驱动安装,一切正常。 Got the php drivers from github as mentioned in the page. 从页面中提到的github获取了php驱动程序。

Later i copied the file mongo.so from the php file extensions directory running on my virtual machine to my parent os and it all works now! 后来我将文件mongo.so从我的虚拟机上运行的php文件扩展目录复制到我的父操作系统,现在一切正常!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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