
Your WordPress site was flying with Redis object caching — until it suddenly shows “Error establishing a Redis connection.” This Redis connection error WordPress fix guide starts where every diagnosis should: Redis is a separate service from WordPress, and this message means WordPress cannot reach it. The fault is almost always at the service level (Redis stopped), the network level (wrong host/port), or the configuration level (mismatched credentials) — not in your posts or theme. This 2026 guide walks through each layer in order.
Redis usually enters a WordPress stack through the Redis Object Cache plugin, which drops an object-cache.php file into wp-content. Every page load then asks Redis for cached objects before touching MySQL. When that backend vanishes, the drop-in throws the connection error instead of silently degrading — which is actually good, because a loud failure beats a mysteriously slow site. The most common trigger on VPS servers is a reboot where Redis was never enabled to start automatically.
What Causes “Error Establishing a Redis Connection”
- Redis service not running: the server rebooted, Redis crashed, or it was never enabled at boot — the number-one cause on self-managed VPS.
- Wrong host or port:
wp-config.phppoints at a host/port where no Redis listens (common after migrations or Docker changes). - Authentication mismatch: Redis requires a password (
requirepass) but WordPress is not sending one, or vice versa. - Firewall or bind address: Redis bound to
127.0.0.1while WordPress connects via another IP, or port 6379 blocked. - Resource exhaustion: Redis hit
maxmemoryor the server ran out of RAM and the OOM killer took it down. - Plugin or PHP extension issues: missing PhpRedis/Predis extension after a PHP upgrade, or a corrupted drop-in.
How to Fix the Redis Connection Error: 8 Steps
Step 1: Check whether Redis is actually running
Over SSH, run redis-cli ping. A PONG reply means Redis is alive — skip to Step 4. “Connection refused” or a timeout means the service is down: start it with sudo systemctl start redis-server (or redis depending on distro) and enable it at boot with sudo systemctl enable redis-server. Then reload the site.
Step 2: Inspect the Redis logs for the real reason
If Redis will not stay up, check journalctl -u redis-server or /var/log/redis/redis-server.log. Look for “Out of memory”, permission errors on the data directory, or port conflicts (“address already in use”). Fix what the log names — restarting blindly without reading it just repeats the crash.
Step 3: Verify memory and disk are not exhausted
Run free -h and df -h. A full disk prevents Redis persistence writes; exhausted RAM invites the OOM killer. If Redis keeps dying under load, raise server RAM or set a sensible maxmemory with an eviction policy like allkeys-lru in redis.conf.

Step 4: Match wp-config.php to the real Redis settings
Open wp-config.php and confirm these constants reflect reality:
define('WP_REDIS_HOST', '127.0.0.1');— the host Redis actually listens ondefine('WP_REDIS_PORT', 6379);— the real portdefine('WP_REDIS_PASSWORD', '...');— only ifrequirepassis set in redis.conf
A host migration or Docker network change silently invalidates these — compare against redis.conf‘s bind and port lines.
Step 5: Check bind address and firewall
If WordPress connects via a LAN IP or hostname, Redis must listen on it: set bind 0.0.0.0 (or the specific interface) in redis.conf and open port 6379 in the firewall (sudo ufw allow 6379). Never expose Redis to the public internet without a strong password — an open Redis is a classic compromise vector.
Step 6: Confirm the PHP Redis extension is installed
After PHP upgrades, the PhpRedis extension sometimes goes missing. Check with php -m | grep -i redis; if empty, install it (sudo apt install php-redis) and restart PHP-FPM. The plugin falls back to Predis (pure PHP) otherwise, which is slower and can mask the real problem.
Step 7: Reinstall the drop-in cleanly
In wp-admin, deactivate Redis Object Cache, delete wp-content/object-cache.php via SFTP, then reinstall and re-enable the plugin. A corrupted drop-in from a failed update causes exactly this error. Flush the cache once from the plugin’s settings after re-enabling.
Step 8: Emergency bypass — disable Redis temporarily
If the site must be up now, rename wp-content/object-cache.php to object-cache.php.bak. WordPress will run without object caching (slower, but alive) while you fix Redis properly. For the sibling database failure, see our database connection error guide.
How to Prevent Redis Connection Failures
- Always
systemctl enableRedis so it survives reboots — the single most-forgotten step. - Monitor the service with uptime checks and alert on repeated restarts.
- Keep PHP, the plugin, and the PhpRedis extension updated together.
- Set
maxmemoryand an eviction policy so Redis degrades gracefully instead of dying. - Back up
redis.confandwp-config.phpbefore server migrations.
Conclusion
“Error establishing a Redis connection” is WordPress telling you its cache backend went quiet: check the service first, then the logs, then the host/port/password trio in wp-config.php. Nine times out of ten it is a stopped service or a stale config line — both fixed in minutes. For more WordPress infrastructure fixes, browse the KamiWeb blog or run a check with our free server tools.
