I’m reaching out regarding an issue we’ve encountered when using the Redis Object Cache plugin with a fresh installation of WordPress 6.7.1. Despite following the official setup guidelines, our WordPress site fails with the following error:
Error establishing a Redis connection
Connection refused
WordPress is unable to establish a connection to Redis. This means that the connection information in your
wp-config.php
file are incorrect, or that the Redis server is not reachable.
- Is the correct Redis host and port set?
- Is the Redis server running?
If you need help, please read the?installation instructions.
To disable Redis, delete the
object-cache.php
file in the/wp-content/
directory.
Here are the details of our setup:
- WordPress Version: 6.7.1 (fresh installation)
- Redis Plugin Version: Redis Object Cache 2.5.4
- Server Environment:
- Dockerized Setup: Using
docker-compose
- Relevant Containers:
- WordPress (
wordpress:php8.0-fpm
)- Redis (
redis:alpine
)- WP-CLI (
custom-wordpress-cli
built on the official WP-CLI image)- Nginx (
nginx:alpine
) for frontend- MariaDB (
mariadb:latest
) for the database- Varnish (
varnish:stable
) for caching- Redis Configuration:
- Redis is running in the
my-redis
container and is reachable from other containers within the Docker bridge network (my_network
).- Redis configuration: Default Alpine Redis settings (
bind *
,protected-mode no
).wp-config.php
Constants for Redis
define("WP_REDIS_HOST", "my-redis");
define("WP_REDIS_PORT", 6379);
define("WP_REDIS_DATABASE", 0);
define("WP_REDIS_DEBUG", true);
define("WP_DEBUG", true);
define("WP_DEBUG_LOG", true);
define("WP_DEBUG_DISPLAY", false);
@ini_set("display_errors", 0);
define("WP_REDIS_TIMEOUT", 5);
define("WP_REDIS_READ_TIMEOUT", 5);
- Plugin Behavior:
- Activating the plugin creates the
object-cache.php
drop-in at/wp-content/
.- The Redis server is accessible (
PONG
response from Redis CLI within the WordPress container).- Enabling Object Cache via the plugin causes the “Error establishing a Redis connection” issue.
Steps we’ve tried:
- Verified network connectivity:
- Pinged
my-redis
from the WordPress container (ping my-redis
works).- Successfully executed
redis-cli -h my-redis ping
from the WordPress container (PONG
response).- Reviewed Redis logs:
- No errors in Redis logs, and
CONFIG GET
shows the expected settings (bind
,protected-mode
, etc.).- Tested Redis connectivity from WP-CLI:
- WP-CLI reports Redis as reachable, but enabling Object Cache causes the same error.
- Tried replacing the
object-cache.php
file:
- Replaced it with the latest version from the plugin’s GitHub repository (branch:
develop
).- Reinstalled the plugin:
- Deactivated, uninstalled, and reinstalled the Redis Object Cache plugin. The error persisted.
- Checked for known compatibility issues:
- Verified that Redis Object Cache 2.5.4 supports Redis 7.4.1 and PHP 8.0.
Summary of issue
- Redis is reachable and functional, yet WordPress fails to connect when Object Cache is enabled.
- The error specifically points to
RedisException: Connection refused
in/wp-content/object-cache.php
.- We suspect a compatibility issue between Redis Object Cache and WordPress 6.7.1 but have not found evidence of this in community forums or issue trackers.
Questions:
]]>
- Are there known issues with the Redis Object Cache plugin and WordPress 6.7.1 or Redis 7.4.1?
- Could this be related to the
object-cache.php
drop-in, or should we consider alternative configurations for Redis?- Are there any additional debug steps or alternative plugin versions (e.g., pre-releases) we should test?
I am using w3tc on my site [redundant URL removed] and i have VPS with 32 GB ram i have installed REDIS on that as well with cpanel / whm
Now the issues is that I want to use specific feature of w3tc https://prnt.sc/8048ioWpNhlN
as here it’s written
Opcode: eAccelerator
which falls under category Dedicated / Virtual Server: which i have VPS
]]>I’m using W3TC as my caching plugin and it works just fine for my site
I also use following snippet at .htaccess to leverage browser caching
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##
So, my question is should I use the above snippet in associated with W3TC plugin
Or it is not necessary though W3TC can provide browser caching option
I’m in confusion about it so need correct answer
Thanks
]]>Could anyone tell what caching plugin wordpress.com uses (if they do use one). As I sometimes have issues with my caching plugin, I would prefer a caching plugin that causes the least problems, rather than have the fastest one. (especially as I upgrade to the latest WordPress versions as soon as they come out). So I would like to use same one as WordPress.
Thanks in advance
]]>But even when I have set cache valid time of 12,000 minutes, there is huge consumption of bandwidth and CC daily. Yesterday I had only 450 page views but the bandwidth usage is 350MB. My concern is Does Hyper Cache Plugin caches images also?? Because 80% of my blog traffic is coming through google images. That may be the reason there is a lot of bandwidth and compute cycles (CC) usage.
Please help me out from this situation. What can I do for images in my blog so that they are served from a local cache rather than from my server?
]]>I have a website developed in wordpress 3. URL is https://www.boldreports.com. I have done extensive research on caching for wordpress and have tested 3-4 plugins on this site. I have used hyer cache with db cache reloaded plugin, and the performance increase was decent. Before trying this i hve tested w3total cache as well. Botht the plugins was setup using default settings. i have not seen noticeable difference using w3tc. May be i have not done the right configuration.
After that i have studied about w3tc in detail and figured out i should use APC for caching. I have installed APC and enabled it. Kindly note that I have virtual Dedicated Server for this site and this is the only site on the server.
After enabling APC cache in apc.ini file, i have opened my website and to my surprise site was not opening in any browser. Even wp-admin pages were not opening. More strange thing is that some wp-admin pages are getting opened and some are not opening. I have disabled all caching plugins including w3tc. but the issue was still there. i have restarted the server but no solution.
Then I have disabled the APC from apc.ini file and everything starts working well.
I do not know why this has happened. I have latest version of APC (installed today) and php 5.2.14.
One more strange thin i have noticed is i can still see APC enabled (means not grayed out)in the drop-down list of w3tc caching plugin.
Can i use it here even APC is disabled from apc.ini
Kindly help me to solve this as i have to begun marketing and SEO of this site.
Thanks and Regards.
GPS