jcaruso jcaruso - 4 months ago 57
PHP Question

PHP 'MongoClient' Not Found

There are tons of questions on this topic, but none of them have worked for me. I originally had the mongodb driver installed (and working) using

sudo pecl install mongo

however according to the pecl output this has been deprecated and replaced with

sudo pecl install mongodb

So I installed that, changed
to load
instead of
(as instructed to by the output of the above
command) . When I load my phpinfo() page it shows that it is loaded

mongodb version 1.0.0
mongodb stability stable
libmongoc version 1.2.0
libbson version 1.2.0

However, when I try to use MongoClient in my PHP page, I get the following error:

Fatal error: Class 'MongoClient' not found in /srv/www/site/functions.php on line 500

I have exhausted all of the 'similar questions' suggested when creating this question, as well as google searches. So I'm hoping someone has some first-hand experience with fixing this because I feel like I'm out of options.


Turns out the class names have changed in the new driver. So MongoClient not existing is a valid error.

new MongoDB\Driver\Manager is the replacement for MongoClient