I have MAMP 1.9 on MAC OSX 10.8.2 using PHP 5.3
I installed MongoDB and the PHP extension mongo.so and added it to my php.ini.
I can run the MongoDB on the console and my phpinfo says MongoDB support is enabled but I cannot run the following PHP script.
<?php $connection = new MongoClient(); ?>
PHP comes up with a fatal error:
Class 'MongoClient' not found
Something seems to be wrong with the autoload configuration of my MAMP (or the extension installation).
As Sammaye mentioned in the comments above, it looks like you’re simply running an older version of the driver. You can obtain the current version by either dumping
Mongo::VERSIONor the returned value fromphpversion('mongo'). Instructions for installing/upgrading the drive via PECL are also documented; however, we no longer have pre-compiled versions available on GitHub (GitHub will soon be removing repository downloads, although we’ve recently begun publishing the Windows builds to S3).