note 105436 rejected from mongo.connecting by danbrown

From: Date: Thu, 18 Aug 2011 16:50:26 +0000
Subject: note 105436 rejected from mongo.connecting by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182573@lists.php.net to get a copy of this message
Note Submitter: leo dot bubbling at socialbubbling dot com ---- Hello, Which one of the below options (or coding style) is best for a production environment to work properly: // Option 1: recreate connection per page $m = new Mongo("mongodb://$user:$pwd@$srvr/$db"); // Option 2: recreate connection per session but reuse within web session $_SESSION["m"] = new Mongo("mongodb://$user:$pwd@$srvr/$db"); // Option 3: create connection once and reuse with web server (across all web sessions) $_SERVER["m"] = new Mongo("mongodb://$user:$pwd@$srvr/$db"); I have read read a lot and bounced back and forth between MongoDB and PHP web sites but it is still unclear to me what approach is best? Thanks and Happy Coding!

« previous php.notes (#182573) next »