Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-8367

php mongodb authentication

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • None
    • None
    • 2
    • KANBAN BUCKET
    • true

    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.

      Attachments

        Issue Links

          Activity

            People

              allison.moore@mongodb.com Allison Reinheimer Moore
              dnkumk@gmail.com Dnku Mekonen
              Jess Mokrzecki Jess Mokrzecki
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                6 years, 12 weeks, 3 days ago