質問

I have uncomented mongodb connection in bootstrap/connections.php and everything seems to be ok but now I'm getting following error:

( ! ) Fatal error: Uncaught exception 'lithium\core\NetworkException' with message 'Could not connect to the database.' in C:\wamp\www\libraries\lithium\data\source\MongoDb.php on line 792
    ( ! ) lithium\core\NetworkException: Could not connect to the database. in C:\wamp\www\libraries\lithium\data\source\MongoDb.php on line 792
    Call Stack
    #   Time    Memory  Function    Location
    1   0.0004  370296  {main}( )   ..\index.php:0
    2   0.0328  2618640 lithium\action\Dispatcher::run( )   ..\index.php:36
    3   0.0328  2619848 lithium\core\StaticObject::_filter( )   ..\Dispatcher.php:122
    4   0.0329  2621472 lithium\util\collection\Filters::run( ) ..\StaticObject.php:128
    5   0.0330  2623800 {closure}( )    ..\Filters.php:182
    6   0.0397  2692456 lithium\util\collection\Filters->next( )    ..\cache.php:47
    7   0.0397  2692488 {closure}( )    ..\Filters.php:201
    8   0.0428  2720784 lithium\util\collection\Filters->next( )    ..\action.php:52
    9   0.0428  2720816 lithium\action\{closure}( ) ..\Filters.php:201
    10  0.0448  2756432 lithium\core\StaticObject::invokeMethod( )  ..\Dispatcher.php:121
    11  0.0448  2756464 lithium\action\Dispatcher::_call( ) ..\StaticObject.php:74
    12  0.0449  2757552 lithium\core\StaticObject::_filter( )   ..\Dispatcher.php:203
    13  0.0449  2757808 lithium\action\{closure}( ) ..\StaticObject.php:121
    14  0.0449  2757808 lithium\action\Controller->__invoke( )  ..\Dispatcher.php:200
    15  0.0449  2759408 lithium\core\Object->_filter( ) ..\Controller.php:184
    16  0.0449  2759688 lithium\action\{closure}( ) ..\Object.php:245
    17  0.0450  2759936 lithium\core\Object->invokeMethod( )    ..\Controller.php:172
    18  0.0450  2759968 app\controllers\PostsController->add( ) ..\Object.php:167
    19  0.0643  3862976 lithium\data\entity\Document->save( )   ..\PostsController.php:25
    20  0.0643  3863176 lithium\data\Entity->__call( )  ..\Entity.php:0
    21  0.0644  3863672 call_user_func_array ( )    ..\Entity.php:197
    22  0.0644  3863936 lithium\data\Model->save( ) ..\Entity.php:0
    23  0.0644  3867352 lithium\data\Model::_filter( )  ..\Model.php:719
    24  0.0645  3867608 lithium\core\StaticObject::_filter( )   ..\Model.php:891
    25  0.0645  3867728 lithium\data\{closure}( )   ..\StaticObject.php:121
    26  0.0723  4182168 lithium\data\source\MongoDb->create( )  ..\Model.php:713
    27  0.0723  4182168 lithium\data\source\MongoDb->_checkConnection( )    ..\MongoDb.php:346

Seems kinda weird issue for me. To be exact was following lithium blog tutorial.

EDIT adding mongo db configuration from phpinfo()

mongo
MongoDB Support enabled
Version     1.1.3

Directive   Local Value Master Value
mongo.allow_empty_keys  0   0
mongo.allow_persistent  1   1
mongo.auto_reconnect    1   1
mongo.chunk_size    262144  262144
mongo.cmd   $   $
mongo.default_host  localhost   localhost
mongo.default_port  27017   27017
mongo.long_as_object    0   0
mongo.native_long   0   0
mongo.no_id 0   0
mongo.utf8  1   1

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top