?
avatar andrepereiradasilva
andrepereiradasilva
25 Jun 2015

Issue description

When using redis through a unix socket (ex: unix:///var/run/redis/redis.sock), instead of a tcp port, joomla can't connect to redis.

Possible solution

It seems to be a simple change, for instance, in line 94 (https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/cache/storage/redis.php#L94), put

if ($server['port']=='0') $connection = static::$_redis->pconnect(str_replace('unix://','',$server['host']));
else $connection = static::$_redis->pconnect($server['host'], $server['port']);

This way if port = 0 it will try to connect wirh a unix socket path (with or without unix://).
I think this is the way memcached joomla cache works too.

The same applies as to be made for persistent connections in the next lines of code.
Tested this simple change and worked.

More information

avatar andrepereiradasilva andrepereiradasilva - open - 25 Jun 2015
avatar zero-24 zero-24 - change - 25 Jun 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 25 Jun 2015
Category Cache Libraries
avatar andrepereiradasilva
andrepereiradasilva - comment - 27 Jun 2015

I discovered that if you put in joomla global config:

  • Redis Host: /path/to/redis.sock
  • Redis Port: -1 It will work without code changes.

But since memcached with linux sockets works in a different way, for instance:

  • Memcached Host: unix:///path/to/memcached.sock
  • Memcached Port: 0

Shouldn't this be normalized in Joomla like it is for TCP connections?

Example:

  • For tcp connection:
    • Connection Type: TCP (default)
    • Host: 127.0.0.1 (accepting IPv4 addr, IPv6 addr ou Host)
    • Port: 6379
  • For Unix socket connection:
    • Connection Type: Unix Socket
    • Host: /path/to/cache-engine.sock (accepting unix file path)
    • Port: 0 or -1 or nothing

This way the config option will have the same normalization for each connection.

avatar brianteeman
brianteeman - comment - 27 Jun 2015

Closing as we have a pull request #7276

avatar brianteeman brianteeman - change - 27 Jun 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-06-27 23:22:54
Closed_By brianteeman
avatar brianteeman brianteeman - close - 27 Jun 2015

Add a Comment

Login with GitHub to post a comment