w3-total-cache-fixed
w3-total-cache-fixed copied to clipboard
redis cache connection bug
Hello,
Redis cache doesn't connect to w3 total cache when it is setted to default redis unix socket /tmp/redis.sock.
So i created new systemd script for redis to listen other unix.socket.
After setting it up to new socket w3 is able to listen this socket.
Tested and working.
But if you want to set redis-server password w3 always refuses the connection !
mod_fcgid: stderr: Redis server went away, referer: https://www.example.com/wp-admin/admin.php?page=w3tc_dbcache
mod_fcgid: stderr: PHP Warning: Redis::pconnect(): connect() failed: Connection refused in /home/www/public_html/wp-content/plugins/w3-total-cache/Cache_Redis.php on line 335, referer: https://www.example.com/wp-admin/admin.php?page=w3tc_dbcache
dig line 335 ..
if ( substr( $server, 0, 5 ) == 'unix:' ) {
if ( $this->_persistent )
$accessor->pconnect( trim( substr( $server, 5 ) ) );
else
$accessor->connect( trim( substr( $server, 5 ) ) );
} else {
list( $ip, $port ) = explode( ':', $server );
if ( $this->_persistent )
$accessor->pconnect( trim( $ip ), (integer) trim( $port ) ); // !!!!!!!!!!!!!!!
else
$accessor->connect( trim( $ip ), (integer) trim( $port ) );
}
So i added unix: prefix unix:/var/run/redis/redis.sock and tried with auth pass and failed again.
Best Regards,
@hsntgm can you confirm if pr #430 solve this issue?
Unfortunately no, but you are on the right way. W3 connect with redis with redis pass so it is false fail message.
Sincerely,
@hsntgm sorry for the very long delay. We have found a bug into the redis persistent connection and it seem your issue. You can check if make this change https://github.com/szepeviktor/w3-total-cache-fixed/pull/483/files in the PR https://github.com/szepeviktor/w3-total-cache-fixed/pull/483 help you?
thanks.