I was trying to use mongodb in one of my applications which is developed in PHP and codeigniter.and the dev env was xampp on my windows 7
I have chooses this library for interacting with mongodb from codeigniter http://getsparks.org/packages/mongodb/versions/HEAD/show as the instructions mentioned in the website i have copied config file and library file in the respective folders and when i was trying to insert some document data into the mongo db i was getting following error.
An Error Was Encountered
The MongoDB PECL extension has not been installed or enabled
below is the step by step guide to :
How to install MongoDB PECL extension in xampp and windows 7.
first download mongodb precompiled driver for php and windows 7
https://github.com/mongodb/mongo-php-driver/downloads
choose the version to download based on the php version that you are using in xampp (go to localhost then you can see which version of php that you are using) if its 5.3x then go for https://github.com/downloads/mongodb/mongo-php-driver/mongo-1.2.4.zip.zip
Extract the contents and copy the file php_mongo.dll to your extension directory which you can find in php.ini file ( default location is C:\xampp\php\ext) default location for php.ini is C:\xampp\php\php.ini)
once you have pasted the dll file in the extension directory open php.ini file and add the following line at the appropriate location
extension=php_mongo.dll

save the file and restart the Server. it should be working fine now.
Some of the common error that you might face; are
PHP startup:mongo: Unable to initialize module
Module compiled with module API=10060613
PHP compiked with module API=20090626
which means you are using the wrong version of the dll file to that of your php version try with other versions and it should be fix.
I have chooses this library for interacting with mongodb from codeigniter http://getsparks.org/packages/mongodb/versions/HEAD/show as the instructions mentioned in the website i have copied config file and library file in the respective folders and when i was trying to insert some document data into the mongo db i was getting following error.
An Error Was Encountered
The MongoDB PECL extension has not been installed or enabled
below is the step by step guide to :
How to install MongoDB PECL extension in xampp and windows 7.
first download mongodb precompiled driver for php and windows 7
https://github.com/mongodb/mongo-php-driver/downloads
choose the version to download based on the php version that you are using in xampp (go to localhost then you can see which version of php that you are using) if its 5.3x then go for https://github.com/downloads/mongodb/mongo-php-driver/mongo-1.2.4.zip.zip
Extract the contents and copy the file php_mongo.dll to your extension directory which you can find in php.ini file ( default location is C:\xampp\php\ext) default location for php.ini is C:\xampp\php\php.ini)
once you have pasted the dll file in the extension directory open php.ini file and add the following line at the appropriate location
extension=php_mongo.dll
save the file and restart the Server. it should be working fine now.
Some of the common error that you might face; are
PHP startup:mongo: Unable to initialize module
Module compiled with module API=10060613
PHP compiked with module API=20090626
which means you are using the wrong version of the dll file to that of your php version try with other versions and it should be fix.
i am trying to connect mongo db with php . but facing some issue
ReplyDeletei am using wamp server.
path you share for php_mongo.dll is empty.
ReplyDeletei use this path for php_mongo.dll
https://github.com/maryo/php-5.5-windows-extensions/tree/master/php_mongo-1.4.5-vc11-x86
this solution works for me.
Thanks
The MongoDB PECL extension has not been installed or enabled
ReplyDeletei found same problem with codeigniter
me too.
DeleteThis comment has been removed by the author.
ReplyDelete