MongoDB Driver issues with XAMPP

890 views
Skip to first unread message

Deepan

unread,
Jun 16, 2013, 11:39:14 PM6/16/13
to mongod...@googlegroups.com

I have issues in PHP-Mongodb Linux installation. After following the below steps, I am not able to access webpages instead it's getting downloaded.

1) Installed MongoDB PHP driver sudo pecl install mongo

2) Added mongo.so to /opt/lampp/lib/php/extensions/no-debug-non-zts-20100525 directory

3) Added "extension=mongo.so" to php.ini file

4) restarted XAMPP sudo /opt/lampp/lampp restart

Environment: Linux Mint 14 - 64 bit

If I try commenting step 3, I can access it but getting mongo class not found exception. Any help in resolving this issue would be appreciated. Thanks.

Hannes Magnusson

unread,
Jun 17, 2013, 1:40:01 PM6/17/13
to mongod...@googlegroups.com
When it gets downloaded, is it just a white page with no content?
If that is the case, please check the PHP error logs, they should shed
some light on what is happening.

-Hannes
> --
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user...@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
>
> ---
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mongodb-user...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Deepan

unread,
Jun 17, 2013, 8:50:39 PM6/17/13
to mongod...@googlegroups.com
Thanks for the reply Hannes. I see source code in the downloaded file and i also see the following error in php error log.

[17-Jun-2013 01:00:43 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/mongo.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/mongo.so: wrong ELF class: ELFCLASS64 in Unknown on line 0

Hannes Magnusson

unread,
Jun 20, 2013, 2:37:15 PM6/20/13
to mongod...@googlegroups.com
Hello Deepan

It seems like when you pecl installed you used the "pecl" command that
came with your operating system, not the one you installed via xampp.
You need to locate the pecl command that came with xampp and use that
to pecl install the mongodb driver.
I would suspect it would look something like:
$ /opt/lampp/bin/pecl install mongodb

-Hannes

Deepan Chakaravarthy Purushothaman

unread,
Jun 20, 2013, 8:00:20 PM6/20/13
to mongod...@googlegroups.com
Thanks Hannes for the reply.

I tried using the lammp pecl for mongo installation, but the installation failed. I have included the error log. Am I missing something?

sudo /opt/lampp/bin/pecl install mongo
...


creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/libtool --mode=compile cc -I./util -I. -I/tmp/pear/temp/mongo -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/include -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/main -I/tmp/pear/temp/mongo -I/opt/lampp/include/php -I/opt/lampp/include/php/main -I/opt/lampp/include/php/TSRM -I/opt/lampp/include/php/Zend -I/opt/lampp/include/php/ext -I/opt/lampp/include/php/ext/date/lib -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/util -I/tmp/pear/temp/mongo/util -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/exceptions -I/tmp/pear/temp/mongo/exceptions -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/gridfs -I/tmp/pear/temp/mongo/gridfs -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/types -I/tmp/pear/temp/mongo/types -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/mcon -I/tmp/pear/temp/mongo/mcon  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/mongo/php_mongo.c -o php_mongo.lo
mkdir .libs
 cc -I./util -I. -I/tmp/pear/temp/mongo -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/include -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/main -I/tmp/pear/temp/mongo -I/opt/lampp/include/php -I/opt/lampp/include/php/main -I/opt/lampp/include/php/TSRM -I/opt/lampp/include/php/Zend -I/opt/lampp/include/php/ext -I/opt/lampp/include/php/ext/date/lib -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/util -I/tmp/pear/temp/mongo/util -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/exceptions -I/tmp/pear/temp/mongo/exceptions -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/gridfs -I/tmp/pear/temp/mongo/gridfs -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/types -I/tmp/pear/temp/mongo/types -I/tmp/pear/temp/pear-build-rootqIDOtH/mongo-1.4.1/mcon -I/tmp/pear/temp/mongo/mcon -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/mongo/php_mongo.c  -fPIC -DPIC -o .libs/php_mongo.o
/tmp/pear/temp/mongo/php_mongo.c:16:17: fatal error: php.h: No such file or directory
compilation terminated.
make: *** [php_mongo.lo] Error 1
ERROR: `make' failed



You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/Rza2_iEIXmQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.

Hannes Magnusson

unread,
Jun 20, 2013, 8:20:13 PM6/20/13
to mongod...@googlegroups.com
It looks like XAMPP didn't install the PHP header files (required to build pecl extensions).

Could you tell me how you installed XAMPP so I can try to reproduce this locally and figureout how exactly to build pecl extensions for it?

-Hannes

Deepan Chakaravarthy Purushothaman

unread,
Jun 20, 2013, 8:32:23 PM6/20/13
to mongod...@googlegroups.com
tar xvfz xampp-linux-1.8.1.tar.gz -C /opt

Hannes Magnusson

unread,
Jun 20, 2013, 9:01:06 PM6/20/13
to mongod...@googlegroups.com
You need to download the "Development package" and install it (tar xvfz xampp-linux-devel*.tar.gz -C /opt ).
That package includes the header files and libraries needed to build pecl extensions like mongodb.

-Hannes

Deepan Chakaravarthy Purushothaman

unread,
Jun 20, 2013, 10:06:45 PM6/20/13
to mongod...@googlegroups.com
Hannes,

The problem on accessing php file still exists.

I installed XAMMP you provided. But still the following error is thrown when I try to access php file. It's downloading the source.

[21-Jun-2013 01:53:14 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/mongo.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/mongo.so: wrong ELF class: ELFCLASS64 in Unknown on line 0


Hannes Magnusson

unread,
Jun 21, 2013, 5:47:25 PM6/21/13
to mongod...@googlegroups.com
It looks like your XAMMP installation is broken, mixing 64bit and 32bit libraries.
I'd recommend you start fresh and download the two xammp packages again, and run the correct pecl binary from the new installation.

If that still doesn't work, please pastebin your entire console so I can see step-by-step what you did.

-Hannes

Deepan Chakaravarthy Purushothaman

unread,
Jun 25, 2013, 12:33:14 AM6/25/13
to mongod...@googlegroups.com
Issue got resolved.

I uninstalled XAMPP and installed Apache and PHP separately. Installed Mongo driver and added mongo.so extension in php.ini as instructed.
http://docs.mongodb.org/ecosystem/drivers/php/

Now I am able to access mongodb from my PHP.

Reply all
Reply to author
Forward
0 new messages