Class 'MongoDB\Driver\Manager' not found
I do not know if it's the most elegant solution, but it worked for me:
- Install the php driver
$ sudo pecl install mongodb
- Create the extension file
$ sudo nano /etc/php5/mods-available/mongodb.ini
and write inside: extension=mongodb.so - Create a symbolic link for this file
$ sudo ln -sv /etc/php5/mods-available/mongodb.ini /etc/php5/apache2/conf.d/20-mongodb.ini
- Create an other symbolic link for this file
$ sudo ln -sv /etc/php5/mods-available/mongodb.ini /etc/php5/cli/conf.d/20-mongodb.ini
- Restart apache or the server used
$ sudo service apache2 restart
It may be necessary to reinstall jenssegers/mongodb: $ composer require jenssegers/mongodb
You may also need to restart fpm on ubuntu/debian
sudo service php7.0-fpm restart
for php5
sudo service php5-fpm restart
Also, make sure extension=mongodb.so
is in:
apache2/php.inicli/php.inifpm/php.ini
to check i do:
locate php.ini | xargs grep mongo
to see php.ini files:
php --ini
When you are going to connect MongoDB database with any PHP application then you can face this issue if you don't have PHP MongoDB driver.
So first you need to run following command to install Mongodb PHP extension :
sudo apt-get install php-mongodb
Now restart the server :
sudo service apache2 restart