Connection refused PHP error in WordPress

Connection refused PHP error in WordPress

While troubleshooting a newish WordPress installation running on LSWS and cPanel I’ve noticed a pretty big error_log file with the following lines:

[06-Jun-2021 18:33:14 UTC] Connection refused
[06-Jun-2021 18:35:15 UTC] Connection refused
[06-Jun-2021 18:37:16 UTC] Connection refused
[06-Jun-2021 18:38:15 UTC] Connection refused

Dozens of lines were added every minute and it’s obvious that something on this site is trying to connect to something else and it doesn’t manage.

Connection refused PHP error
Connection refused PHP error

In my case it was LiteSpeed Cache WordPress plugin which is set to use Redis for Object Caching. The problem in particular was that the server was rebooted and since each cpanel user has a unique and random port when they start Redis, the user defined port number was no longer correct.

To fix this re-activate Redis and change the port number in the plugin settings.

redis not working - Connection refused PHP error in WordPress

If you are using Memchached make sure that the service is running, check if the extension is activated and that the defined port number is correct.

Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.