Your WordPress site shows a plain page that says “Error establishing a Redis connection”, and you are the owner or administrator who has to bring it back. The screen comes from the Redis Object Cache plugin, which keeps the results of repeated database lookups in Redis, a data store that lives in memory. When Redis fails to answer, the plugin stops the page. One line in wp-config.php turns the cache off and brings the site back. After that, a short technical message tells you which of a few causes you have, and each cause has a known fix.
What you’ll accomplish
- Bring the site back online with a one-line change, without deleting anything.
- Read the real error behind the screen, such as
Connection refusedorNOAUTH. - Match that message to its cause and apply the fix.
- Turn the cache back on and confirm that the plugin reports
Connected.
Prerequisites
- The Redis Object Cache plugin by Till Krüss. The messages and constants quoted here were checked against version 3.0.1. Object Cache Pro, LiteSpeed Cache and W3 Total Cache show their own messages.
- A way to edit
wp-config.php: SSH, SFTP or your control panel’s file manager. - For the checks on Redis itself, shell access to the server and the
redis-clitool. WP-CLI (thewpcommand) is used at the end. - Redis 6 or newer for the parts about ACL users, which are named Redis accounts with their own password and permissions.
How it works
The plugin works through one file, wp-content/object-cache.php. WordPress calls this kind of file a drop-in: it loads the file on every request, before any plugin, and uses it in place of its built-in cache.
On each request, the drop-in does three things. It connects to Redis over a TCP port or a unix socket, which is a special file that two programs on the same server use to talk. It signs in, if a password is set. Then it reads and writes cached values while the page is built.
A failure at any of the three stages produces the same screen. The heading is always “Error establishing a Redis connection”, even when the connection itself is fine and Redis refused a write because its memory is full. The message underneath is what you need, and the plugin shows it in only two cases: on a /wp-admin/ address, or when WP_DEBUG is on. Visitors see the heading and one line about deleting object-cache.php.
The plugin’s WP_REDIS_GRACEFUL constant, false by default, keeps the site loading when Redis fails. Settings → Redis then shows Status: Not connected. The plugin’s README lists this constant as unsupported and warns that it will cause data corruption, so do not use it as the fix. If it is already set, the steps below still apply.
Step-by-step
-
Copy the real error, then turn the cache off. Open
https://example.com/wp-admin/in your browser. The first line under the heading, in monospaced type, is the real error. Copy it.Now edit
wp-config.phpand add this line above the comment that saysThat's all, stop editing!:define( 'WP_REDIS_DISABLED', true );The drop-in stays in place but does nothing, and WordPress goes back to its built-in cache. Reload the site to confirm.
If you cannot edit
wp-config.php, rename the drop-in instead. This has the same effect:mv wp-content/object-cache.php wp-content/object-cache.php.offEither way, the built-in cache keeps nothing between requests. Pages are slower and the database works harder, so do not leave it this way.
-
Find the message if you did not copy it. The plugin also writes every Redis error to the PHP error log. When
WP_DEBUGandWP_DEBUG_LOGare bothtrue, that log iswp-content/debug.log. Otherwise, use the path of your server’s PHP error log. Search it:grep -h "Exception: " wp-content/debug.log | tail -n 3Example output:
[17-Nov-2026 13:52:08 UTC] RedisException: Connection refused in /home/acme/public_html/wp-content/object-cache.php:819The text between the colon and
in /is the message. When the plugin uses the Predis client library instead of PhpRedis, the address follows the message, as inConnection refused [tcp://127.0.0.1:6379]. If the log has nothing, open Settings → Redis in the dashboard. While the plugin cannot connect or sign in, a red notice there reads “Redis is unreachable:”, followed by the message. -
Test Redis from the server. Print the connection settings that WordPress uses. The output includes the password, so do not paste it into a ticket:
grep -E "WP_REDIS_(SCHEME|HOST|PORT|PATH|DATABASE|PASSWORD|USERNAME)" wp-config.phpExample output:
define( 'WP_REDIS_HOST', '127.0.0.1' ); define( 'WP_REDIS_PORT', 6379 ); define( 'WP_REDIS_DATABASE', 4 );A setting that is missing uses its default: scheme
tcp, host127.0.0.1, port6379, database0, no password. Now ask Redis for a reply with the same values. Use the first command for a host and port, and the second whenWP_REDIS_PATHis set:redis-cli -h 127.0.0.1 -p 6379 ping redis-cli -s /run/redis/redis.sock pingPONGmeans Redis is up and accepts you. Any other answer is an error message to look up in the next step. Keep the same-hand-p, or-s, on every laterredis-clicommand. IfWP_REDIS_PASSWORDis set, add--askpassand type that password. Without it,redis-clianswersNOAUTHeven when WordPress signs in correctly. -
Match the message to its cause. Use the message from step 1, 2 or 3:
Message contains What it means Go to Connection refusedNothing listens at that address and port Step 5 php_network_getaddressesThe host name does not resolve Step 5 No such file or directoryThe socket file is not at that path Step 6 Permission deniedPHP is not allowed to open the socket file Step 6 NOAUTH,WRONGPASSorERR AUTHThe password or user is wrong Step 7 OOM command not allowedRedis is full and is not allowed to delete anything Step 8 MISCONFRedis failed to save to disk and now blocks writes Step 9 LOADINGRedis is starting and still reading its data Step 9 read error on connection,Error while reading lineortimed outRedis answered too slowly Troubleshooting -
Start Redis, or correct the address. Check the service. It is named
redis-serveron Debian and Ubuntu, andredison Red Hat, AlmaLinux and Rocky Linux, so use your system’s name in both commands:systemctl status redis-server journalctl -u redis-server --since "1 hour ago" | tail -n 20If the first one says
inactiveorfailed, the second shows why Redis stopped. Start it withsudo systemctl start redis-server, then run thepingfrom step 3 again.If the service is
activeand thepingstill fails, WordPress is using the wrong address. List where Redis listens:sudo ss -ltnp | grep redisExample output:
LISTEN 0 511 127.0.0.1:6380 0.0.0.0:* users:(("redis-server",pid=1482,fd=6))Here Redis listens on port
6380, soWP_REDIS_PORTmust be6380. The address127.0.0.1means that Redis accepts connections from the same server only. If Redis runs on another machine, thebindline in that machine’sredis.confmust include an address the web server can reach. Set a Redis password and restrict the port in the firewall before you open it that way.For
php_network_getaddresses, rungetent hostsfollowed by the value ofWP_REDIS_HOST. If it prints nothing, the name does not resolve from this server. -
Repair the socket path or its permissions. Look at the socket file:
ls -l /run/redis/redis.sockExample output:
srwxrwx--- 1 redis redis 0 Nov 17 08:47 /run/redis/redis.sockIf
lsanswersNo such file or directory, compare the path with theunixsocketline inredis.conf, and setWP_REDIS_PATHto the real one.WP_REDIS_SCHEMEmust beunix. If theunixsocketline starts with#, Redis creates no socket at all.For
Permission denied, read the left column. In the example, the ownerredisand the groupredismay use the socket, and nobody else. That matchesunixsocketperm 770inredis.conf. The user that runs PHP must be in that group. Add it, with your PHP user in place ofacme, and test as that user:sudo usermod -aG redis acme sudo -u acme redis-cli -s /run/redis/redis.sock pingThe second command must answer
PONG. Then restart PHP-FPM, so that its running processes pick up the new group. -
Correct the password or the ACL user. Each message points to a different mismatch:
NOAUTH Authentication required.Redis has a password and WordPress sent none. AddWP_REDIS_PASSWORDtowp-config.php, above theThat's all, stop editing!line. A constant defined below that line is read too late.WRONGPASS invalid username-password pair or user is disabled.The password or user name is not the one Redis expects.ERR AUTH <password> called without any password configured for the default user.WordPress sends a password, and Redis has none. If Redis should have one, put therequirepassline back inredis.confand restart Redis. Otherwise, removeWP_REDIS_PASSWORD.
For an ACL user, give the user name and the password as a pair:
define( 'WP_REDIS_PASSWORD', [ 'wp_acme', 'your-redis-password' ] );Test the same pair from the shell.
--askpassprompts for the password, so it stays out of your shell history:redis-cli --user wp_acme --askpass pingA message that starts with
NOPERMmeans the user exists but is not allowed the command or the key. The Redis ACL documentation explains how to grant them. -
Free memory when Redis is full. Read the memory settings:
redis-cli INFO memory | grep -E "used_memory_human|maxmemory_human|maxmemory_policy"Example output:
used_memory_human:255.98M maxmemory_human:256.00M maxmemory_policy:noevictionmaxmemoryis the limit you gave Redis.maxmemory_policysays what Redis does at the limit. Withnoeviction, the default, it deletes nothing and refuses every write with theOOMmessage, which stands for “out of memory”. For a cache, tell Redis to delete the keys used least recently, then save the setting:redis-cli CONFIG SET maxmemory-policy allkeys-lru redis-cli CONFIG REWRITEEach command answers
OK. IfCONFIG REWRITEanswers with an error, addmaxmemory-policy allkeys-lrutoredis.confby hand, or the setting is lost at the next restart. Do this only when this Redis holds nothing but cache. If it also holds queues or sessions,allkeys-lruwill delete those too. In that case, raisemaxmemoryor give the cache its own Redis. The Redis eviction documentation describes every policy. -
Clear a failed save, or wait for a restart to finish.
MISCONFmeans the last background save to disk failed. Withstop-writes-on-bgsave-error yes, the default, Redis then refuses writes. Check the save and find the folder it writes to:redis-cli INFO persistence | grep rdb_last_bgsave_status redis-cli CONFIG GET dirExample output:
rdb_last_bgsave_status:err 1) "dir" 2) "/var/lib/redis"Run
df -h /var/lib/redisto check for a full disk. Then read the Redis log from step 5 for a line such asCan't save in background: fork: Cannot allocate memory. Free disk space or memory, then runredis-cli BGSAVE, which answersBackground saving started. Once the first command above printsrdb_last_bgsave_status:ok, Redis accepts writes again without a restart. Settingstop-writes-on-bgsave-errortonoonly hides the message: Redis then accepts data that it cannot save, and loses it at the next restart.LOADING Redis is loading the dataset in memoryappears right after Redis starts. Wait, and repeatredis-cli INFO persistence | grep "^loading:". When it printsloading:0, Redis is ready. -
Turn the cache back on. Remove the
WP_REDIS_DISABLEDline fromwp-config.php, or rename the file back toobject-cache.php. Then empty the cache right away, because Redis may still hold values from before the outage:wp cache flushThe answer is
Success: The cache was flushed.This empties the whole Redis database, for every site that shares its number. If the command does not print that line, Redis is still failing: put theWP_REDIS_DISABLEDline back and return to step 4.
Validate it works
Ask the plugin for its status, then load the site:
wp redis status | head -n 6
curl -s -o /dev/null -w '%{http_code}\n' https://example.com/
Example output:
Status: Connected
Client: PhpRedis (v6.1.0)
Drop-in: Valid
Disabled: No
Ping: 1
Errors: []
200
You are done when the first line reads Status: Connected, Errors is empty and the site answers 200. Status: Disabled (via config constant) means the line from step 1 is still in wp-config.php. Status: Not enabled means the drop-in is missing; run wp redis enable to put it back.
Troubleshooting
read error on connection,Error while reading lineor a message withtimed out. By default, the plugin waits one second to connect and one second for each reply. If this shows up rarely, Redis was busy for a moment. If it persists, find out why Redis is slow before you raise the limits. Runredis-cli --latencyfor a few seconds, then press Ctrl+C. It prints the slowest reply asmax, in milliseconds. For a delay you accept, such as a Redis on another machine, setWP_REDIS_TIMEOUTandWP_REDIS_READ_TIMEOUTabove that figure. Both are in seconds, and2is a starting value, not a rule.redis-clianswersPONG, and WordPress still fails. For a socket, test as the PHP user, as in step 6. If PHP runs in a container,127.0.0.1is the container itself, not the server where Redis runs.- The status reads
Drop-in is invalid. Another caching plugin replacedobject-cache.phpwith its own file. Turn off that plugin’s object cache, then runwp redis update-dropin.
When this is the wrong approach
On a managed host where Redis is part of the plan, you often cannot restart it or read its settings. Do step 1, then send the host the exact message from step 1 or 2. Ask for the current host and port or socket path, the password or ACL user, the database number, and the memory limit.
If Redis was never set up on this server, start with Redis object cache setup on cPanel. If the screen says “Error establishing a database connection”, the problem is MySQL, not Redis: see Error establishing a database connection.
Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.