The Symptoms
You log on to a server that is having performance issues, you do some basic troubleshooting only to find a PHP error log, several gigabytes in size, that contains just the one, particularly unhelpful, error message… over and over again.
[Wed Jun 04 13:24:18.154183 2021] [proxy_fcgi:error] [pid 817092:tid 139701387010829] [client 1002:41e0:6:b32a:::0] AH01234: Got error 'PHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refusedPHP message: Connection refused
The Cause
With such a generic error message it could be any number of things but in my case it turned out to be caused by W3 Total Cache for WordPress (W3TC). W3TC supports a number of different cache methods, this includes things like Redis and Memcached. If you have configured W3TC to use Redis and you have the incorrect connection settings or you are on shared hosting and don’t have the appropriate access you might end up with an error log that is spamming the phrase `PHP message: Connection refused` over and over again, dozens or hundreds of times a second.
It should be noted that this won’t stop the WordPress site from working, it might not even have a major performance impact, the first sign of a problem may even be the server running out of disk space.
The Solution
Switch to a disk based cache or reconfigure/get access to the caching service you have selected. Honestly this is pretty obvious once you actually know what the issue is.
Edit: It might also be worth double checking Redis/Memcached is actually installed as W3TC can sometimes show the option as active when it’s not actually installed on the server.
sudo systemctl status redis
sudo systemctl status memcached
1 Comment
Daniel Gutierrez · 10 January 2023 at 1:37 am
Thank you so much! I believed that plesk installed automatically redis, and I was having a lot of problems because w3tcache