WordPress网站博客提示“此站点遇到了致命错误 “怎么解决?有时候很不幸遇到了这个问题,搜索解决方案,发现致命错误的原因有很多,所以需要先打开WordPress的WP_DEBUG功能,然后按照提示进行下一步操作。 从5.2版本开始,WordPress增加了一个新功能,即当检测到某个插件或主题出现错误时,会自动发送邮件通知站长。 即使后端完全无法访问,管理员仍然有机会登录到后端并对其进行操作。 这是新WordPress的致命错误(WSOD)处理程序。

但是大多数情况下,我们是无法正常接收到错误信息的,所以遇到问题可以手动启动调试模式。

文章目录
一、开启 WP Debug 模式
二、找到 WP 致命的错误

一、开启 WP Debug 模式

既然出错了,就需要开启 DEBUG 模式,显示详细的错误信息。

1、打开 WordPress 配置文件 wp-config.php,将 WP_DEBUG 这一行修改为如下代码即可:

// 开启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');

调试好后,请千万记得关闭 DEBUG 模式,即将上述内容改回:

define( 'WP_DEBUG', false);

二、找到 WP 致命的错误

做完第一步之后,直接网页刷新显示错误的页面,可看到详细的报错内容,此时已经显示出来错误路径。

大多数情况下,发生致命错误,主要是博客的主题、插件、PHP 内存、文件目录权限,甚至是当前主题函数模板 functions.php 内多了个标点符号的原因。

而如果博客正常情况下是可以打开,但是偶然出现了报错,那么博主可以检查下,近期是否有对主题和插件做了修改或更新,大多数情况,更多的是主题和插件更新导致的不兼容,建议直接恢复默认主题,停用插件观察,如果通过WP_DEBUG可以直接定位到问题,那么也可以根据错误提示找到问题所在,针对性的解决。WordPress website blog prompts “This site has encountered a fatal error” how to fix? Sometimes unfortunately encountered this problem, search for solutions, found that there are many reasons for the fatal error, so you need to open the WP_DEBUG function of WordPress, and then follow the prompts to the next step. Starting from version 5.2, WordPress has added a new feature that automatically sends emails to notify webmasters when an error is detected in a plugin or theme. Even if the backend is completely inaccessible, the administrator still has the opportunity to log in to the backend and operate on it. This is the new WordPress Fatal Error (WSOD) handler.
But in most cases, we can’t receive the error message normally, so if we encounter problems, we can manually start the debug mode.
Article table of contents 1. Turn on WP Debug mode 2. Find fatal errors in WP 1. Turn on WP Debug mode Since there is an error, you need to turn on DEBUG mode to display detailed error messages.
1. Open the WordPress configuration file wp-config.php, and modify the WP_DEBUG line to the following code: // Enable WP_DEBUG mode define(‘WP_DEBUG’, true);// Enable DEBUG log, be sure to turn off this log function And clean up this log file, the generated log file is: /wp-content/debug.logdefine( ‘WP_DEBUG_LOG’, true);// Display errors and warningsdefine( ‘WP_DEBUG_DISPLAY’, true);@ini_set( ‘display_errors’, ‘On’); After debugging, please remember to turn off the DEBUG mode, that is, change the above content back to: define( ‘WP_DEBUG’, false); 2. Find the fatal error of WP and finish the first step, directly refresh the page On the wrong page, you can see the detailed error content, and the error path has been displayed at this time.
In most cases, fatal errors occur mainly because of the blog’s theme, plugins, PHP memory, file directory permissions, and even a 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 plugin have been modified or updated recently. In most cases, it is more caused by the theme and plugin update. Incompatible, it is recommended to restore the default theme directly, disable plug-in observation, if you can directly locate the problem through WP_DEBUG, you can also find the problem according to the error prompt and solve it in a targeted manner.

发表评论

后才能评论