Hey! Did you try verifying your connection settings by connecting through the redis-cli?
Thread Starter
swiftc
(@swiftc)
Sorry for delay, Yes I have other things like PHP Sessions being cached in another db also using AUTH OK via php.ini:
===
session.save_handler = redis
session.save_path = “tcp://127.0.0.1:6379?database=10&auth=mypass”
===
That all works OK. But for WordPress via plugin I see this in Apache error_log:
===
[01-Mar-2016 21:13:51 UTC] PHP Fatal error: Uncaught exception ‘RedisException’ with message ‘Failed to AUTH connection’ in /home/example/public_html/wp-content/plugins/wp-redis/object-cache.php:939
Stack trace:
#0 [internal function]: Redis->flushAll()
#1 /home/example/public_html/wp-content/plugins/wp-redis/object-cache.php(939): call_user_func_array(Array, Array)
#2 /home/example/public_html/wp-content/plugins/wp-redis/object-cache.php(1047): WP_Object_Cache->_call_redis(‘flushAll’)
#3 /home/example/public_html/wp-content/plugins/wp-redis/object-cache.php(155): WP_Object_Cache->__construct()
#4 /home/example/public_html/wp-includes/load.php(473): wp_cache_init()
#5 /home/example/public_html/wp-settings.php(95): wp_start_object_cache()
#6 /home/example/public_html/wp-config.php(84): require_once(‘/home/example…’)
#7 /home/example/public_html/wp-load.php(37): require_once(‘/home/example…’)
#8 /home/example/public_html/wp-blog-header.php(12): require_once(‘/home/example…’)
#9 /home/example/public_html in /home/example/public_html/wp-content/plugins/wp-redis/object-cache.php on line 939
===
Thanks for any help!
Hey!
I can’t reproduce your issue when using a password and the PECL Redis extension.
However there might be a bug in PHPRedis: https://github.com/phpredis/phpredis/issues/661
I’d recommend you ask your web developer to debug the WP_Object_Cache::__construct() in /wp-content/object-cache.php and if you find a bug, you can submit a PR to the GitHub repository: https://github.com/tillkruss/Redis-Object-Cache
Thread Starter
swiftc
(@swiftc)
I hope this will help someone else.
I resolved this by moving the below lines from “wp-config.php” to “object-cache.php”
===
define(‘WP_REDIS_HOST’, ‘127.0.0.1’);
define(‘WP_REDIS_PORT’, ‘6379’);
define(‘WP_REDIS_DATABASE’, ‘1’);
define(‘WP_REDIS_PASSWORD’, ‘mypass’);
define(‘WP_CACHE_KEY_SALT’, ‘example.com’);
===
Thanks.
Did you try adding the Redis constants above the following line in your wp-config.php?
require_once ABSPATH . 'wp-settings.php';
Thread Starter
swiftc
(@swiftc)
Thanks Trill that was the issue! :O)