The error:
PHP Fatal error: require_once(/home/user/public_html/wordfence-waf.php):
failed to open stream: No such file or directory
indicates that Wordfence's Web Application Firewall (WAF) is missing or corrupted.
Run:
ls -lah /home/user/public_html/wordfence-waf.php
If the file does not exist, proceed to restore or recreate it.
If you have a backup of your WordPress site, restore the wordfence-waf.php file from:
If the file is restored, restart Apache/Nginx:
sudo systemctl restart apache2
or
sudo systemctl restart nginx
If the file cannot be restored, recreate it.
nano /home/user/public_html/wordfence-waf.php<?php
// Wordfence Web Application Firewall
if (file_exists(__DIR__ . '/wp-content/wflogs/bootstrap.php')) {
include_once __DIR__ . '/wp-content/wflogs/bootstrap.php';
}Set correct permissions:
chmod 644 /home/user/public_html/wordfence-waf.php
chown www-data:www-data /home/user/public_html/wordfence-waf.php # For Apache
chown nginx:nginx /home/user/public_html/wordfence-waf.php # For Nginx
sudo systemctl restart apache2
or
sudo systemctl restart nginx
If wordfence-waf.php is still missing, check your wp-config.php file.
wp-config.php for editing:
nano /home/user/public_html/wp-config.phpdefine("WFWAF_LOG_PATH", '/home/user/public_html/wp-content/wflogs/');Try loading your site again.
If Wordfence is still broken, reinstall it:
wp plugin deactivate wordfence
wp plugin delete wordfence
wp plugin install wordfence --activate
Now Wordfence WAF should work properly!
| Issue | Fix |
|---|---|
| File missing | Restore from backup or recreate manually |
| Permissions incorrect | Set chmod 644 and chown www-data:www-data |
| Wrong wp-config.php settings | Add define("WFWAF_LOG_PATH", ...) |
| Wordfence corrupted | Reinstall with wp plugin install wordfence |
Now Wordfence WAF should be working again!