I have been plagued by this error message intermittently for about 6-months.
PHP Fatal error: Uncaught exception 'MongoException' with message 'The MongoCursor object has not been correctly initialized by its constructor' in /data_local/app/dff/inc/DffDataObj_db_mongo.class.php:37
Specifically "The MongoCursor object has not been correctly initialized by its constructor"
I have searched on Google off and on but never found any good solution.
Finally I accidentally found the solution, because I installed another web server which has a newer MongoDB PHP Extension Driver.
Instantly the problem is gone.
It turns out culprit was the PHP Extension version that had the problem was 1.5.0, I got that from PECL. The error usually happen when a MongoDB connection has been opened for at least 0.5 second and that connection was either used in loop doing multiple queries to Mongo, or it was used to query multiple collections. In any case, the error was somewhat intermittent and hard to debug.
The solution and how-to fix this problem is very simple, you simply need to upgrade it.
Type this on your shell:
pecl list
That should tell you all PHP packages you have installed using PECL.
Mine looks like this:
Installed packages, channel pecl.php.net:
=========================================
Package Version State
mongo 1.6.10 stable
But before I upgraded that used to say 1.5.0
Anyways here is the command I used to upgrade to latest stable version:
pecl upgrade mongo
After upgrade process completed, you can run
pecl list
again to double check to make sure your version has been upgraded.
and you can also make sure on PHP info using the following command:
php -i
(look for mongo section and check the version there)
That is all... I hope that help some one like me! :-)
No comments:
Post a Comment