Привет, я пытаюсь подключиться mongo DB(Version 3.4.18)
, используя CakePHP (version 3.5.1) with Apache server on PHP (7.2.4)
и сталкиваюсь с ошибкой ниже
2019-07-01 10:41:09 Error: [Error] Class 'MongoClient' not found in E:\xampp\htdocs\myproject\src\Controller\AppController.php on line 142
Request URL: /
Stack Trace:
#0 E:\xampp\htdocs\myproject\src\Controller\PagesController.php(219): App\Controller\AppController->__connectmongodb()
#1 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Controller\Controller.php(441): App\Controller\PagesController->home()
#2 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\ActionDispatcher.php(119): Cake\Controller\Controller->invokeAction()
#3 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\ActionDispatcher.php(93): Cake\Http\ActionDispatcher->_invoke(Object(App\Controller\PagesController))
#4 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\BaseApplication.php(103): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#5 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(65): Cake\Http\BaseApplication->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#6 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Routing\Middleware\RoutingMiddleware.php(107): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#7 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(65): Cake\Routing\Middleware\RoutingMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#8 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Routing\Middleware\AssetMiddleware.php(88): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#9 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(65): Cake\Routing\Middleware\AssetMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#10 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Error\Middleware\ErrorHandlerMiddleware.php(93): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#11 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#12 E:\xampp\htdocs\myproject\vendor\cakephp\debug_kit\src\Middleware\DebugKitMiddleware.php(52): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#13 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(65): DebugKit\Middleware\DebugKitMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#14 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(51): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#15 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Server.php(81): Cake\Http\Runner->run(Object(Cake\Http\MiddlewareQueue), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#16 E:\xampp\htdocs\myproject\webroot\index.php(40): Cake\Http\Server->run()
#17 {main}
для моноблочного соединения с БД, используя приведенный ниже код
public function __connectmongodb()
{
$m = new \MongoClient('mongodb://localhost:27017');
return $db = $m->myDb;
}
Примечание : я должен сделать это в mongo DB(Version 3.4.18)
, используя CakePHP (version 3.5.1) with Apache server on PHP (7.2.4)
эти конкретные версии
ОБНОВЛЕНИЕ - мы пытаемся на Windows, используя php_mongodb-1.4.0-7.2-ts-vc15-x64
этот файл .dll