I have Latest Adminer (4.6.3) installed on Debian Stretch with PHP7.0 & Mongo 3.2 (installed from Debian repos). I am running with Nginx and PHP-FastCGI. I have installed the mongodb PHP driver (required for PHP7) via: pecl install mongodb. phpinfo reports: "MongoDB extension version 1.5.2".
When I try to connect to it via Adminer I get an error: Expected string for "password" URI option, null given. (Obviously I am including a password).
I tried installing the MongoDB PHP Library but that didn't change things (although perhaps I'm missing something?)
To confirm that it wasn't an issue with my Mongo setup itself, I tried a docker container dockette/adminer:full-php5 (which uses the old mongo PHP driver with PHP5.6). Using that I could connect to my MongoDB fine.
To see if something was amiss with my Adminer/PHP setup itself, I tried the "Official" Docker adminer:latest container (Adminer 4.6.3 in standalone config with fastcgi). That one doesn't come with the PHP mongodb driver, but following some instructions that I found here I installed the driver (FWIW somewhat similiar to what I'd used to install on Debian). After restarting that, I'm now getting a completely different error! Database does not support password.
Any insight would be appreciated.
FWIW the maintainer of the docker-adminer container has noted that the
Database does not support password.with MongoDB (using the mongodb PHP driver) is a current limititation of Adminer.This is what Adminer does:
I don't see how "Expected string for "password" URI option, null given" can happen (if you are really passing a password). "Database does not support password" can happen if your Mongo doesn't support password. You can fix that by checking the password in
Adminer::loginand returning an empty password fromAdminer::credentials.@jakubvrana Why these 2 lines? Mongo DB can be secured by login and password saved in some AuthDB.
For example:
When I'm connecting to mongo from bash I have to:
... only if auth success I can access to collections, etc.
You can try it with these settings in /etc/mongo
Last edit: Vojtěch Dušátko 2019-09-20
The lines are there because the user might think that the database supports password but it actually doesn't. You can also try setting
MONGO_AUTH_SOURCEwhich Adminer supports recently.Adminer doesn't let you log in using credentials if it's also possible to log in without a password.
As a workaround, I created a docker image which removes the additional check for the empty password. More info in the gist itself
https://gist.github.com/cilf/017348bfbce87fb95ff61e295415a54f
I'm not sure if it's problem of Adminer or environment, but the described behaviour works on PHP5 for me and doesn't work on PHP7.
The main problem is, that on PHP 7 connect with wrong credentials (empty pass, wrong pass, ...) doesn't throw exception.
I also report it on Dockette