Troubleshooting Common Wordfence Security Scan Failures and Server Crashes
Content
If you manage multiple WordPress sites, you've likely encountered a scenario where Wordfence Security scans fail to complete or, worse, cause server-wide performance issues by running simultaneously. These problems are frustratingly common, but they are often solvable by understanding their root causes. Based on community reports and common configurations, this guide outlines the most frequent reasons for scan failures and provides actionable solutions.
Why Do Scans Fail or Crash Servers?
Scan issues typically fall into a few categories: server resource constraints, configuration conflicts, or communication problems between the plugin and your server. A recurring theme across multiple reports is that these problems are especially prevalent on servers hosting several WordPress installations.
Common Problems and Their Solutions
1. Simultaneous Scans Overwhelming the Server
The Problem: Despite the promise of random start times, scans on multiple sites begin at the same moment, consuming all server resources and causing crashes.
Why It Happens: This often occurs due to the nature of WP-Cron, which triggers scheduled tasks like Wordfence scans only when a site is visited. On low-traffic sites or servers where many sites experience a traffic spike simultaneously, overdue cron jobs can all fire at once.
The Solution: The most effective fix is to replace the default WP-Cron with a real system cron job. This gives you precise control over when tasks run. You can set up a server cron to trigger your site's WP-Cron.php file at regular intervals (e.g., every 1 or 5 minutes). This prevents a backlog of tasks and ensures scans are spaced out.
2. Immediate Scan Failure with "Scan stop request received"
The Problem: The scan fails the moment it starts, and the log shows a "Scan stop request received" message. Diagnostics may reveal a "wp_remote_post() test back to this server failed!" error.
Why It Happens: This error indicates your site cannot make a connection back to itself, a necessary function for the scan to operate. Common culprits include:
- Outdated PHP: There are reports of this being a specific issue with PHP 7.4.33 in environments using Nginx as a reverse proxy and Cloudflare.
- Incorrect IP Detection: If you use Cloudflare, misconfigured IP detection can break internal communication.
- Server Firewalls: Security modules like ModSecurity or server-level firewalls (e.g., BitNinja) may be blocking the internal POST requests.
The Solution:
- Upgrade PHP: Test your site on a newer PHP version (8.1 or 8.2). This has been reported to resolve the communication issue.
- Configure Cloudflare Correctly: In Wordfence > All Options > General Wordfence Options, ensure the setting "How does Wordfence get IPs" is correctly configured to "Use the Cloudflare 'CF-Connecting-IP' HTTP header."
- Check Server Security: Temporarily disable server-level security services to see if they are the cause. If they are, you will need to add rules to whitelist internal POST requests to admin-ajax.php and other WordPress core files.
3. Scans Not Checking URLs or Specific Files
The Problem: A scan completes but reports scanning "0 URLs," or it keeps flagging files you know are safe.
Why It Happens: The scan options may be disabled, or you may need to exclude certain directories from the scan to prevent false positives or performance bottlenecks.
The Solution:
- Verify Scan Settings: Navigate to Wordfence > All Options > Scan Options. Confirm that the following are enabled:
- Scan file contents for malicious URLs
- Scan posts for known dangerous URLs and suspicious content
- Scan comments for known dangerous URLs and suspicious content
- Exclude Files Properly: To exclude a directory like a cache or uploads folder, use the "Exclude files from scan that match these wildcard patterns" option in the Advanced Scan Options. Use the path relative to your WordPress root directory. For example, to exclude all files in a specific uploads subfolder across a multisite network, you could use:
wp-content/uploads/sites/*/folder-name/*
4. Scan Failures After a Site Migration
The Problem: Scans begin failing after moving a site to a new host or server.
Why It Happens: Wordfence creates and uses its own tables in the WordPress database. During a migration, if old server paths are stored in these tables, it can cause the plugin to malfunction.
The Solution: A clean reinstall often resolves this. First, export your Wordfence settings from Wordfence > Tools > Import/Export Options. Note that whitelisted URLs are not included in this export, so manually note them down from Wordfence > Firewall > All Firewall Options > Whitelisted URLs. Then, completely deactivate and delete Wordfence. Reinstall it fresh and import your saved settings.
Final Checklist
- [ ] Replace WP-Cron with a system cron job to space out scans.
- [ ] Upgrade PHP to version 8.1 or higher.
- [ ] Verify Cloudflare IP detection settings if applicable.
- [ ] Check for server-level firewall blocks on internal requests.
- [ ] Confirm all URL scanning options are enabled.
- [ ] Use wildcard patterns to exclude non-essential directories from scans.
- [ ] Perform a clean reinstall after a site migration.
By methodically working through these common issues, you can resolve most Wordfence scan failures and prevent them from impacting your server's stability.
Related Support Threads Support
-
All websites on server start at SAME TIME scan and crash server.https://wordpress.org/support/topic/all-websites-on-server-start-at-same-time-scan-and-crash-server/
-
Scan consistently fails on one site but works fine on another (same host, nearlyhttps://wordpress.org/support/topic/scan-consistently-fails-on-one-site-but-works-fine-on-another-same-host-nearly/
-
SCAN ARE NO MORE WORKINGhttps://wordpress.org/support/topic/scan-are-no-more-working/
-
Wordfence not scanning URLs during scanhttps://wordpress.org/support/topic/wordfence-not-scanning-urls-during-scan/
-
exclude folders from scanhttps://wordpress.org/support/topic/exclude-folders-from-scan/
-
Scan Stage Failedhttps://wordpress.org/support/topic/scan-stage-failed-29/
-
Scan for PHP processeshttps://wordpress.org/support/topic/scan-for-php-processes/
-
Scan failures on multiple siteshttps://wordpress.org/support/topic/scan-failures-on-multiple-sites/