Home »
Imported messages »
comp.lang.php »
Problem with PHP Driver Authentication
Problem with PHP Driver Authentication [message #179128] |
Fri, 14 September 2012 08:20 |
picc09
Messages: 1 Registered: September 2012
Karma:
|
Junior Member |
|
|
Hi,
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://127.0.0.1:27017');
$db = $mongo->db_name;
$db->authenticate('user','pass');
-- new version of the code that does not work --
$mongo = new Mongo('mongodb://user:pass(at)127(dot)0(dot)0(dot)1:27017/db_name');
$db = $mongo->db_name;
throws exception:
MongoConnectionException: Couldn't authenticate with database db_name: username [user] in ...
Why?
What's wrong?
MongoHub working properly, mongo console is working properly, why PHP throws an exception?
Thanks in advance!
A.
|
|
|
Goto Forum:
Current Time: Wed Nov 27 14:09:04 GMT 2024
Total time taken to generate the page: 0.04162 seconds