Hi @grahammazie, thanks for your detailed message.
For the first message regarding the database errors, when seeing a “Commands out of sync” database error in your logs, there are often other plugins getting the same error as well.?The issue happens because some plugins, including Wordfence, use PHP’s “shutdown handler” to run some code after the rest of a database request has finished. But if the database connection is lost during a request, this shutdown code still runs and triggers reconnecting to the database, but the database isn’t in a state where queries can be run, if the database is unavailable due to shutting down or if a query limitation set by the hosting provider is reached for example. The ‘commands out of sync’ errors are not the actual cause of a problem, but rather side-effects of the database getting disconnected. When this error is logged, it’s because something else already failed, but it isn’t visible in PHP’s error log.
If you have WP-CLI you can run a query like
wp db query ‘\s’
…which should show you the database server’s uptime. The same can be done on the mysql command line by just typing?\s. In a couple cases reported to us where users had the access to do this, they did find that the database server had recently restarted when they saw these errors. Generally, your hosting provider will need to look into the problem with the database, though with the few sites where we’ve seen this problem, we have not heard back about the host’s solution if they were able to fix it. If your host is willing to send us logs, including?mysql/mariadb logs?and the?syslog, we may be able to help determine the cause.
The IP your server is trying to contact is correct, and the error message about the API Key is actually the expected result for the test you ran, so communication to our servers and back appears to be working.
If you’ve not been able to find the cause of the issue, please send a diagnostic report to wftest @ wordfence . com from the affected site. The diagnostic can directly come from the plugin using the link at the top of the Wordfence > Tools > Diagnostics page.
Afterwards, click on “Send Report by Email”. Please add your forum username where indicated and respond here after you have sent it.
NOTE: It should look as follows – Screenshot of Tools > Diagnostic > Send by Email
Thanks again,
Peter.