Php Mongodb driver not working. Fatal error: Uncaught Error: Class "MongoDB\\Driver\\Manager" not found

44 Views Asked by At

I am using php_mongodb-1.15.1-7.4-ts-x64 driver. My php version is : 8.2. Already updated php.ini file and included extension=php_mongodb.dll in php.ini file. Now I am running my Xampp apache to run my php code. My php code includes-

`$m = new MongoDB\\Driver\\Manager("mongodb://localhost:27017");
echo "Connection to database successfully";
$db = $m -\> mydb;
echo "Database mydb selected";`

but after running I am getting this error Fatal error: Uncaught Error: Class "MongoDB\Driver\Manager" not found in C:\xampp\htdocs\phpmongo\index.php:2 Stack trace: #0 {main} thrown in C:\xampp\htdocs\phpmongo\index.php on line 2.

Not sure why this is happening.

Changed my php mongodb dll to 1.17, 1.16. But nothing is working

changed php mongodb dll version 1.17, 1.16 but did not worked.

0

There are 0 best solutions below