Description
Description
I'm trying to connect to MongoDB through PHP, but I get the error: "MongoDB\Driver\Exception\AuthenticationException Authentication failed." I don't have a username or password set up, so I'm pretty confused. I can connect to MongoDB through shell and compass, both without entering any username/password. I already tried looking up the issue in several different places (stackoverflow, mongodb-user groups.google.com, etc.) for several days but I can't find any help so I decided to post an issue here. I'm using the Yii2 framework but I don't think this problem is related to that.
Environment
Windows 10 (64-bit)
PHP version 7.2.2 on XAMPP
MongoDB 4.0.6
Mongo PHP Driver 1.6.0alpha1 for PHP 7.2 Threaded x86
phpinfo():
MongoDB support | enabled |
---|---|
MongoDB extension version | 1.6.0alpha1 |
MongoDB extension stability | alpha |
libbson bundled version | 1.13.0 |
libmongoc bundled version | 1.13.0 |
libmongoc SSL | enabled |
libmongoc SSL library | OpenSSL |
libmongoc crypto | enabled |
libmongoc crypto library | libcrypto |
libmongoc crypto system profile | disabled |
libmongoc SASL | enabled |
libmongoc ICU | disabled |
libmongoc compression | disabled |
Expected and Actual Behavior
Expected connection to MongoDB, but resulted in error thrown.
I would include more info if I knew what to include. This is my first time working with MongoDB (and NoSQL in general) so I'm pretty unknowledgeable in this area.
Thanks in advance. :)