PHP Mongo: Notice: Mongo::__construct(): parsing servers
Asked Answered
D

1

6

I am wondering why I am getting the following php notice:

( ! ) Notice: Mongo::__construct(): parsing servers in C:\htdocs\multishop\library\Lupi\Resource\Odm.php on line 38
Call Stack
#   Time    Memory  Function    Location
1   0.0004  138504  {main}( )   ..\index.php:0
2   0.0130  667392  Zend_Application->bootstrap( )  ..\index.php:25
3   0.0130  667488  Zend_Application_Bootstrap_BootstrapAbstract->bootstrap( )  ..\Application.php:355
4   0.0130  667504  Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap( ) ..\BootstrapAbstract.php:586
5   0.0442  2068704 Zend_Application_Bootstrap_BootstrapAbstract->_executeResource( )   ..\BootstrapAbstract.php:626
6   0.0442  2068832 Lupi_Resource_Odm->init( )  ..\BootstrapAbstract.php:683
7   0.0596  2778880 Mongo->__construct( )   ..\Odm.php:38

Line 38:

 $dm = DocumentManager::create(new \Doctrine\MongoDB\Connection(new \Mongo), $config);

The notice appears sometimes, not all the time. I am using doctrine mongo ODM.

Doit answered 8/7, 2012 at 5:15 Comment(5)
I have exactly the same problem!Kymry
Answer here if you solved it pleaseKymry
@radashk I still didn't solve it, Are you using it with any framework such as zend or symfony?Doit
Me too.. Maybe this problem always found if we use CodeigniterWeanling
@SosialLab I have the same issue using zendframework. I gotta try using symfony It seems to has better mongodb support than other frameworks.Doit
P
3

This message is being emitted by the driver (see: parse.c or the log-1.phpt unit test). This behavior is only controlled by the MongoLog class (there are no ini options for it) and logging is disabled by default, so you'd certainly know if you were activating it. My guess is that some library related to CodeIgniter is the culprit (that's the only common thread I can make out).

You can take a look at the MongoLog documentation for more information, but the following should completely disable logging for all levels and modules:

\MongoLog::setLevel(\MongoLog::NONE)
\MongoLog::setModule(\MongoLog::NONE)
Pedometer answered 29/7, 2012 at 4:14 Comment(1)
To disable shouldn't it be MongoLog::NONE?Doit

© 2022 - 2024 — McMap. All rights reserved.