WordPress prompts “This site encountered a fatal error” solution

WordPress prompts “This site encountered a fatal error” solution

WordPress website blog prompts "This site encountered a fatal error." How to solve it? Today, Lao Tang unfortunately encountered this problem. After searching for a solution, he found that there are many causes of fatal errors, so he needs to turn on the WP_DEBUG function of WordPress first, and then follow the prompts for the next step. Since version 5.2, WordPress has added a new feature, which is to automatically send an email to notify the website administrator when an error is detected in a plug-in or theme. Even in the event that the backend is completely inaccessible, the administrator still has the opportunity to log into the backend and take action on the issue. This is the new WordPress fatal error (WSOD) handler.

But in most cases, we do not receive error message emails normally, so when we encounter problems, we can manually turn on debugging mode.

1. Turn on WP Debug mode
. Since an error occurred, you need to turn on DEBUG mode to display detailed error information.

1. Open the WordPress configuration file wp-config.php and modify the WP_DEBUG line to the following code:

// 开启WP_DEBUG模式
define( 'WP_DEBUG', true);
// 开启DEBUG日志,一定要记得关闭这个日志功能并清理这个日志文件哦,产生的日志文件在: /wp-content/debug.log
define( 'WP_DEBUG_LOG', true);
// 显示errors and warnings
define( 'WP_DEBUG_DISPLAY', true);
@ini_set( 'display_errors', 'On');

After debugging, please remember to turn off DEBUG mode and change the above content back:

define( 'WP_DEBUG', false);

2. Find the WP fatal error.
After completing the first step, directly refresh the page that displays the error. You can see the detailed error content, and the error path has been displayed.

In most cases, fatal errors occur mainly due to the blog's theme, plug-ins, PHP memory, file directory permissions, or even an extra punctuation mark in the current theme function template functions.php.

If the blog can be opened under normal circumstances, but an error occurs occasionally, the blogger can check whether the theme and plug-ins have been modified or updated recently. In most cases, it is more caused by theme and plug-in updates. Incompatible, it is recommended to directly restore the default theme and disable plug-in observation . If the problem can be directly located through WP_DEBUG, you can also find the problem according to the error message and solve it in a targeted manner.

If it is a plug-in problem, just mv the plug-in directory directly. For example, the following error is reported:

#0 /usr/share/nginx/html/shop3/wordpress/wp-content/plugins/ultimate-member/includes/core/class-builtin.php(1456): UM->fields()

Solution:

mv /usr/share/nginx/html/shop3/wordpress/wp-content/plugins/ultimate-member /usr/share/nginx/html/shop3/wordpress/wp-content/plugins/ultimate-member-bak

Guess you like

Origin blog.csdn.net/cljdsc/article/details/132768552