Problem with PHP Driver Authentication

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a problem in the mongo's config on my computer that I use for local test.

-- mongodb.conf --
dbpath = /path/to/data
logpath = /path/to/mongo.log
logappend = true
auth = true

-- startup command --
sudo mongod -f /path/to/mongodb.conf --fork

I also tried:

sudo mongod -f /path/to/mongodb.conf --fork --auth

-- computer installation --
OSX 10.7.4
PHP 5.3.14 (ZendServerCE 5.6)
Mongo 2.2.0
PHP Mongo Driver: 1.2.12

-- php file that works but deprecated --
$mongo = new Mongo('mongodb://');
$db = $mongo->db_name;

-- new version of the code that does not work --
$mongo = new Mongo('mongodb://user:pass@');
$db = $mongo->db_name;

throws exception:

MongoConnectionException: Couldn't authenticate with database db_name: username
[user] in ...

What's wrong?
MongoHub working properly, mongo console is working properly, why PHP throws an

Thanks in advance!


Re: Problem with PHP Driver Authentication

On 9/14/2012 4:20 AM, wrote:
Quoted text here. Click to load it

Did you ask in Mongo support?  They know their code better than anyone else.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline