[DOCS-8367] php mongodb authentication Created: 16/Jul/16  Updated: 05/Jan/17  Resolved: 05/Jan/17

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Dnku Mekonen Assignee: Allison Reinheimer Moore
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Dev

Location: https://docs.mongodb.com/manual/reference/privilege-documents/
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
Referrer: http://stackoverflow.com/questions/18179334/show-users-from-mongodb-in-php
Screen Resolution: 1366 x 768


Issue Links:
Related
related to DOCS-8719 SSL not mentioned in PHP driver docs Closed
Participants:
Days since reply: 7 years, 5 weeks, 6 days ago
Story Points: 2

 Description   

Details
-----------------------------------------------------------------------------
PHP Version 5.5.12
Compiler MSVC11 (Visual C++ 2012)
Architecture x64
mongodb driver: php_mongo-1.5.7-5.5-vc11-x86_64.dll
-----------------------------------------------------------------------------

Please give example how to connect to mongodb

I try this:
$m = new MongoClient ("mongodb://$user:$pass@{$host}:{$port}");

Or this:
$m = new MongoClient ("mongodb://{$host}:{$port}",[
'username' => $user,
'password' => $pass
]);

Error I have got:
Failed to connect to: localhost:27017: SASL Authentication failed on database 'admin': Authentication failed.



 Comments   
Comment by Allison Reinheimer Moore [ 05/Jan/17 ]

Fixed as part of Jeremy's PHP Library docs updates.

Generated at Thu Feb 08 07:56:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.