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) file is missing or misconfigured.
Run this command in SSH or use cPanel File Manager:
ls -lah /home/user/public_html/wordfence-waf.php
After restoring, restart Apache/Nginx:
sudo systemctl restart apache2
or
sudo systemctl restart nginx
If you cannot restore the file, create it manually.
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';
}
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 still does not work, verify the WAF settings in wp-config.php.
wp-config.php:
nano /home/user/public_html/wp-config.phpdefine("WFWAF_LOG_PATH", '/home/user/public_html/wp-content/wflogs/');Try loading your website again.
If the issue persists, reinstall Wordfence:
wp plugin deactivate wordfence
wp plugin delete wordfence
wp plugin install wordfence --activate
This will recreate all necessary files.
| Issue | Fix |
|---|---|
| wordfence-waf.php is missing | Restore from backup or recreate manually |
| File exists but still errors | Check file permissions (chmod 644) |
| Incorrect Wordfence settings | Update wp-config.php (define("WFWAF_LOG_PATH", ...)) |
| Wordfence corrupted | Reinstall with wp plugin install wordfence |
Now Wordfence WAF should work properly again!