sasanrose / phpredmin

Yet another web interface for Redis
BSD 3-Clause "New" or "Revised" License
404 stars 96 forks source link

Unable to connect to server with authentication #63

Closed devoto13 closed 9 years ago

devoto13 commented 9 years ago

If you add server and set password for it, then you will end up with and exception. You can see it in the logs as:

[error]: Failed to AUTH connection on /opt/phpredmin/libraries/drivers/db/redis.php:7

The problem seems to come from following code:

    $this->connect($config['host'], $config['port']);
    $this->select($config['database']);

    if (isset($config['password'])) {
        $this->auth($config['password']);
    }

The reason is that select db command issued before authentication and failed. To fix it I changed it to the following code:

    $this->connect($config['host'], $config['port']);

    if (isset($config['password'])) {
        $this->auth($config['password']);
    }

    $this->select($config['database']);

PS I'm using Redis 2.8.4. I think this solution should work for older versions either, but haven't checked.

sasanrose commented 9 years ago

Sorry for delay. Fixed. Thank you for reporting