3

I followed the following steps to install mongo's php drivers with lampp.

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

When I start lampp its gives the following error

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

Any ideas?

Thanking you

2 Answers 2

6

This means that your PHP is compiled in 32-bit mode, but the mongo extension as 64-bit mode. I believe Apple's compiled PHP is in 32-bit mode as well, you can verify that with:

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

If that shows

9223372036854775807
you're on a 64-bit platform.

Now, in your case you will need to make sure that you compile the MongoDB extension with a 32-bit architecture. 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:

pecl download mongo
tar -xvzf mongo-1.2.7.tgz
cd mongo-1.2.7

CFLAGS="-m32"

phpize
./configure
make
make install
Sign up to request clarification or add additional context in comments.

11 Comments

-thanx, but I am on linux ( Ubuntu ) – Imran Omar Bukhsh
running php -r 'echo PHP_INT_MAX, "\n";' gives me 2147483647
do I need to type 'make install' at the end?
Uh, yes, you need make install
well the problem still persists
|
0

The problem was as is outlined by Derick above. 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. Later followed the 'Manual Installation section' on this page for the php driver installation and it all worked. Got the php drivers from github as mentioned in the page.

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.