After moving a site or deleting some files, I see: PHP Fatal error: Unknown: Failed opening required /var/www/html/wordfence-waf.php
If the Wordfence Firewall is set up with "Extended Protection", and you move a site to a new host, it is likely that the location of the wordfence-waf.php file will no longer be the same. That can cause an error message that appears like this when the firewall tries to load:
PHP Fatal error: Unknown: Failed opening required '/var/www/html/wordfence-waf.php' (include_path='.:/usr/share/php') in Unknown on line 0
The path "/var/www/html/" will usually be different on your site. This message can also occur if you delete wordfence-waf.php unintentionally.
To fix the issue and allow the site to load without an error message again, you can remove the auto_prepend_file setting from your site's files, as described here:
The auto_prepend_file line will appear in one of three files, depending on how your host has set up their server, explained in the link above. Note that the error message may still appear up to 5 minutes after removing the firewall files on many hosts, due to a type of caching.
After removing the firewall setup, you can set it up on the new host again within your WordPress admin pages (see the button to optimize the firewall, on the Firewall page on the Wordfence menu), and Wordfence will automatically use the file's new location.