After migrating a WordPress website ot another cPanel account, the website displayed 500 error, and the following was recorded inside the error_log file:
[17-Aug-2022 12:46:18 Europe/Belgrade] PHP Fatal error: Unknown: Failed opening required ‘/home/XXXXX/XXXXX.com/wordfence-waf.php’ (include_path=’.:/opt/alt/php74/usr/share/pear’) in Unknown on line 0
WordFence adds rules to .htaccess file to include the wordfence-waf.php file by full path:
php_value auto_prepend_file ‘/home/XXXXXX/wpxss.com/wordfence-waf.php’
This file is related to the Wordfence Firewall “optimization” option.
So after changing the cPanel username or migrating to another account it is needed to change the username and path to the wordfence-waf.php file
Edit the .htaccess file and change the path:
Save the file and visit your website again.