Any idea how to solve this issue??
Undefined property: MongoDB\Driver\Manager
Please post additional information, most importantly the full error message and the offending line. It looks like you’re accessing an undefined property, but without knowing what you’re actually doing, there’s no way for us to help you.
“i am also facing Undefined property: MongoDB\Driver\Manager::$mydb in /var/www/html/index.php on line 5”
‘when I want to connect with the MongoDB with PHP’
<?php
//$m = new MongoDB\Driver\Manager();
$m = new MongoDB\Driver\Manager("mongodb://192.168.0.105:27017");
echo "Connection to database successfully";
$db = $m->mydb;
echo $db;
echo "Database mydb selected";
?>
‘I am using PHP 7.4 and MongoDB Version 3.6.3’
@NAEEM_AKRAM , “Undefined property” is usually related to missing PHP definitions from a require or require_once. In this case, it looks like the definition of the MongoDB\Driver\Manager was not included upstream in your app.
We have a great set by step tutorial to get started with PHP and MongoDB. In there, we recommend using the PHP Library instead of using the low-level driver directly.
And a follow-up article about how to detect and handle potential PHP errors in the context of MongoDB:
Check them out and let us know,