Reputation: 67
I need to use Mongodb in my PHP script.
So I have installed php_mongodb.dll from php_mongodb-1.2.5-5.6-ts-vc11-x64.zip into "C:\wamp64\bin\php\php5.6.25\ext\". I have added extension.dll in php.ini.
When I run php.exe, there is nothing wrong, any warning... But Mongodb doesn't appear in the list of php extensions (phpinfo()).
In addition, my index.php returns "Fatal error: Class 'Mongo' not found in C:\wamp64\www\scripts\index.php on line 47".
The line 47 : $con = new Mongo(); # localhost:27017
I have already tried php_mongodb.dll or php_mongo.dll, different other versions... But now, I have any idea.
If someone has solution to propose, he will be welcome. Thank you in advance.
Upvotes: 1
Views: 2511
Reputation: 673
To whom may concern !
I migrated a system:
Do not replace new Mongo
, create an alias instead. This is what I did.
$this->connectionDB = new Mongo('...');
use MongoDB\Driver\Manager as Mongo;
$this->connectionDB = new Mongo('...');
And you don't need to fix anything.
Upvotes: 0
Reputation: 67
Finally, I found a solution... The right dll !
In fact, I must use MongoDB PHP Driver on Windows. Then add extension=php_mongodb.dll into php.ini. And download the corresponding file from mongodb 1.2.5, in this case 5.6 Thread Safe (TS) x64.
php.exe shows no warning and the line 47 ($con = new MongoDB\Driver\Manager("mongodb://localhost:27017"); # localhost:27017
) works correctly.
Don't forget to restart services.
Hopefully this solution will serve...
Upvotes: 0