Merge pull request #140 from rickvanderzwet/fix_redis_unix_socket_connect

Fix unable to connect to redis socket
This commit is contained in:
Marius Lindvall 2020-05-25 14:50:14 +02:00 committed by GitHub
commit 076dc9ac84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -8,8 +8,13 @@ class MemWrapper {
function __construct() {
$this->redis = new Redis();
$this->redis->connect(getConfig("redis_host"), getConfig("redis_port"))
or die ("Server could not connect to Redis!\n");
if(substr(getConfig("redis_host"), 0, 1) === "/") {
$this->redis->connect(getConfig("redis_host"))
or die ("Server could not connect to Redis socket!\n");
} else {
$this->redis->connect(getConfig("redis_host"), getConfig("redis_port"))
or die ("Server could not connect to Redis!\n");
}
if (getConfig("redis_use_auth")) {
$this->redis->auth(getConfig("redis_auth"))
or die("Incorrect Redis authentication!");