Dealing with “protocol error, got ‘E’ as reply-type byte” and LSCache Plugin Object Cache

Content Error or Suggest an Edit

Notice a grammatical error or technical inaccuracy? Let us know; we will give you credit!


I was getting the following errors within the error logs for a WordPress site that was on an Openlitespeed server and couldn’t figure out the issue. I replaced the IP address with and the domain with

2023-04-14 07:31:06.562149 [NOTICE] [20082] [] [STDERR] protocol error, got 'E' as reply-type byte
2023-04-14 07:31:10.758529 [NOTICE] [20082] [] [STDERR] protocol error, got 'R' as reply-type byte
2023-04-14 07:31:29.775871 [NOTICE] [20082] [] [STDERR] protocol error, got 'R' as reply-type byte
2023-04-14 07:31:36.157094 [NOTICE] [20082] [] [STDERR] protocol error, got 'O' as reply-type byte
2023-04-14 07:31:42.998521 [NOTICE] [20082] [] [STDERR] protocol error, got 'R' as reply-type byte

Googling the Error

There isn’t much about this error other than this phpredis Github issue.

protocol error, got ‘E’ as reply type byte · Issue #369 · phpredis/phpredis · GitHub
Hi. After connecting and checking if key exists i get an error which is: protocol error, got ‘E’ as reply type byte Redis server is: Redis server v=2.6.7 sha=00000000:0 malloc=jemalloc-3.2.0 bits=64 phpredis module is latest from GIT (cl…

GridPane Staffer Suggested Redis Was the Culprit

I didn’t think it was related until I saw a private GridPane community forum posting. A GridPane staffer mentioned the following

Haven’t seen that one in a few years. You would have a number of options, increase the Redis memory and CPU limits if applied or scale up the system or move to a newer PHP version with better error handling. If PHP isn’t 7.3 or 7.4 and it has been updated in last year, this is memory/timeout issue

I had challenged this

I’ve been getting the same on some sites, and haven’t had a chance to investigate :frowning:

I’m assuming you found this hence the Redis comment protocol error, got ‘E’ as reply type byte · Issue #369 · phpredis/phpredis · GitHub 1

Have you confirm this error is related to Redis?

Digging Further, Confirming LSCache Configuration, Mistakes and Resolution

I decided to go back and find the site I saw the errors on, the errors were still occurring with every page request.

I decided to disable the LSCache Object Cache setting, and once this occurred, the error went away. But was still present when visiting the Object Cache Settings page, which was actually the LSCache plugin testing the Redis connection. Then I realized the “Connection Test” stated, “Failed”.

At this point, I realized that there was an issue connecting to Redis, so I reviewed the configuration above and found that the port was set to 112111 which is used for Memcached. I changed the port to 6379 which turned the “Connection Test” to “Passed”. The errors no longer showed up in the error log.

Troubleshooting Connection Issues and Testing Redis

The resolution was a simple incorrect port specified, in the example above. However, this is not the only time the errors would show. Anytime there is an issue connecting to Redis this error could potentially come up. If the above resolution didn’t address the errors you’re receiving, then here are some troubleshooting tips.

1. Confirm LSCache Configuration

Confirm that the LSCache plugin is configured correctly and states “Passed” under the “Connection Test”. Ensure you have the right hostname and port, or unix socket location (/var/run/redis/redis-server.sock) and the port set to “0” if you’re using a unix socket.

2. Confirm Redis server is running and listening for connections

Confirm Redis server is running and listening

netstat -anp | grep redis

3. Test Connecting to Redis

Even if Redis is running, you might not be able to connect to it for a number of reasons. So use the following PHP script and upload it to the webroot of your website. Make sure to change the Unix socket and TCP socket information.


// Connect to Redis Unix socket
$unixSocketRedis = new Redis();

// Set a key-value pair via Unix socket
$unixSocketRedis->set('unixkey', 'unixvalue');

// Get the value for a key via Unix socket
$unixValue = $unixSocketRedis->get('unixkey');

// Output the Unix socket value
echo "Unix socket value: $unixValue\n";

// Close the Unix socket connection

// Connect to Redis TCP socket
$tcpSocketRedis = new Redis();
$tcpSocketRedis->connect('', 6379);

// Set a key-value pair via TCP socket
$tcpSocketRedis->set('tcpkey', 'tcpvalue');

// Get the value for a key via TCP socket
$tcpValue = $tcpSocketRedis->get('tcpkey');

// Output the TCP socket value
echo "TCP socket value: $tcpValue\n";

// Close the TCP socket connection

4. Other Suggestions

  • If the methods above fail, then you need to dig deeper and confirm if a username and password is set.
  • If you’re using the unix socket method to connect, ensure the correct permissions are set so that your website’s PHP worker can connect. This will be contained within redis.conf. Depending there could be a permission issue.
  • With a TCP socket, perhaps name resolution will be an issue, so try for the hostname. You could also try and connect to the TCP socket using telnet localhost 6379

5. Redis Timeouts

It’s quite possible that the Redis request is timing out or there is an issue with the Redis server responding. This is a sign up resources issues on the server your website is located. You can confirm this by accessing your site and checking the log. You could tail -f the log file using SSH.

Other Error Messages

Here are error messages you might also encounter, mainly for the Google search index.

LSCache WordPress Plugin and Redis Socket

This occurred when not setting the port to 0 and using a Unix socket as the hostname. If you’re using a Unix socket, you must set the port to 0 in LSCache.

2023-04-14 07:48:08.473725 [NOTICE] [20082] [] [STDERR] php_network_getaddresses: getaddrinfo failed: Name or service not known

If you enter the incorrect information in the LSCache configuration fields, it could result in the following errors.

2023-04-14 08:32:37.955912 [NOTICE] [3733] [] [STDERR] Invalid argument

LSCache WordPress Plugin and wp-cli Errors

If you’re using wp-cli and for some reason, there is an issue with the LSCache WordPress plugin connecting to Redis. You will see the error show up in wp-cli which can cause issues with automation or provide a false sense of urgency that your WordPress has a severe error. When in reality it’s simply a connection issue, that should be logged and not through wp-cli.

Unknown Error Messages

Here are some errors that you might see that I have not been able to track down. Most of them relate to the phpredis extension for PHP

GitHub – phpredis/phpredis: A PHP extension for Redis
A PHP extension for Redis. Contribute to phpredis/phpredis development by creating an account on GitHub.
2022-10-05 07:59:36.561241 [NOTICE] [662] [] [STDERR] PHP Fatal error:  Uncaught RedisException: protocol error, got 'a' as reply type byte
2022-10-05 07:59:36.936958 [NOTICE] [662] [] [STDERR] protocol error, got '[' as reply-type byte
2022-10-05 07:59:37.435134 [NOTICE] [662] [] [STDERR] protocol error, got '^' as reply-type byte
You May Also Like