在 WordPress 的系统盘重新部署后(PHP 7.4 升级至 PHP 8.1),提示:此站点遇到了致命错误。
1、参考:在阿里云的 ECS 中,CentOS 7 迁移(更换)至 Alibaba Cloud Linux 3 。 在 WordPress 的系统盘重新部署后,提示:此站点遇到了致命错误。如图1
2、了解有关对WordPress进行故障排除的更多信息。启用开发者专用:WordPress 调试模式。编辑 wp-config.php
/** * 开发者专用:WordPress 调试模式。 * * 将这个值改为“true”,WordPress 将显示所有用于开发的提示。 * 强烈建议插件开发者在开发环境中启用本功能。 */ define('WP_DEBUG', true);
3、再次刷新页面,报错
Deprecated: Return type of HM\BackUpWordPress\CleanUpIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /data/wwwroot/www.shuijingwanwq.com/wp-content/plugins/backupwordpress/classes/class-path.php on line 456 Fatal error: Uncaught Error: Undefined constant "wp_cumulus_widget" in /data/wwwroot/www.shuijingwanwq.com/wp-content/plugins/wp-cumulus/wp-cumulus.php:375 Stack trace: #0 /data/wwwroot/www.shuijingwanwq.com/wp-includes/class-wp-hook.php(308): widget_init_wp_cumulus_widget() #1 /data/wwwroot/www.shuijingwanwq.com/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #2 /data/wwwroot/www.shuijingwanwq.com/wp-includes/plugin.php(517): WP_Hook->do_action() #3 /data/wwwroot/www.shuijingwanwq.com/wp-includes/widgets.php(1854): do_action() #4 /data/wwwroot/www.shuijingwanwq.com/wp-includes/class-wp-hook.php(308): wp_widgets_init() #5 /data/wwwroot/www.shuijingwanwq.com/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #6 /data/wwwroot/www.shuijingwanwq.com/wp-includes/plugin.php(517): WP_Hook->do_action() #7 /data/wwwroot/www.shuijingwanwq.com/wp-settings.php(623): do_action() #8 /data/wwwroot/www.shuijingwanwq.com/wp-config.php(87): require_once('...') #9 /data/wwwroot/www.shuijingwanwq.com/wp-load.php(50): require_once('...') #10 /data/wwwroot/www.shuijingwanwq.com/wp-blog-header.php(13): require_once('...') #11 /data/wwwroot/www.shuijingwanwq.com/index.php(17): require('...') #12 {main} thrown in /data/wwwroot/www.shuijingwanwq.com/wp-content/plugins/wp-cumulus/wp-cumulus.php on line 375
4、发现皆是插件的报错,决定先想办法禁用掉相关报错的插件。由于WordPress仪表盘,则需要以不同的方式禁用插件。参考:如何禁用WordPress插件(4种方法)。
5、参考:如何通过phpMyAdmin禁用WordPress插件 。其本质是操作数据库中的数据。
6、先备份数据库,再操作数据。打开表 wp_options,如图2
7、在选项表中,在 option_name 列中查找 active_plugins 条目。执行以下查询 SQL。如图3
SELECT * FROM `wp_options` WHERE `option_name` = 'active_plugins'
8、复制查询结果记录中的 列 option_value 的值,使用 php 在线反序列化工具。
a:14:{i:0;s:53:"accelerated-mobile-pages/accelerated-moblie-pages.php";i:1;s:19:"akismet/akismet.php";i:2;s:35:"backupwordpress/backupwordpress.php";i:3;s:33:"classic-editor/classic-editor.php";i:4;s:36:"contact-form-7/wp-contact-form-7.php";i:5;s:45:"disable-google-fonts/disable-google-fonts.php";i:6;s:72:"golang-brush-for-syntaxhighlighter-evolved/syntaxhighlighter-GoBrush.php";i:7;s:25:"hueman-addons/ha-fire.php";i:8;s:15:"light/light.php";i:9;s:33:"nimble-builder/nimble-builder.php";i:10;s:47:"regenerate-thumbnails/regenerate-thumbnails.php";i:11;s:39:"syntaxhighlighter/syntaxhighlighter.php";i:12;s:25:"wp-cumulus/wp-cumulus.php";i:13;s:27:"wp-pagenavi/wp-pagenavi.php";} Array ( [0] => accelerated-mobile-pages/accelerated-moblie-pages.php [1] => akismet/akismet.php [2] => backupwordpress/backupwordpress.php [3] => classic-editor/classic-editor.php [4] => contact-form-7/wp-contact-form-7.php [5] => disable-google-fonts/disable-google-fonts.php [6] => golang-brush-for-syntaxhighlighter-evolved/syntaxhighlighter-GoBrush.php [7] => hueman-addons/ha-fire.php [8] => light/light.php [9] => nimble-builder/nimble-builder.php [10] => regenerate-thumbnails/regenerate-thumbnails.php [11] => syntaxhighlighter/syntaxhighlighter.php [12] => wp-cumulus/wp-cumulus.php [13] => wp-pagenavi/wp-pagenavi.php )
9、在反序列化的结果中删除掉插件:backupwordpress/backupwordpress.php、wp-cumulus/wp-cumulus.php,再将 PHP 序列化后的结果存入至列 option_value 的值。PHP 代码实现如下
<?php $a = 'a:14:{i:0;s:53:"accelerated-mobile-pages/accelerated-moblie-pages.php";i:1;s:19:"akismet/akismet.php";i:2;s:35:"backupwordpress/backupwordpress.php";i:3;s:33:"classic-editor/classic-editor.php";i:4;s:36:"contact-form-7/wp-contact-form-7.php";i:5;s:45:"disable-google-fonts/disable-google-fonts.php";i:6;s:72:"golang-brush-for-syntaxhighlighter-evolved/syntaxhighlighter-GoBrush.php";i:7;s:25:"hueman-addons/ha-fire.php";i:8;s:15:"light/light.php";i:9;s:33:"nimble-builder/nimble-builder.php";i:10;s:47:"regenerate-thumbnails/regenerate-thumbnails.php";i:11;s:39:"syntaxhighlighter/syntaxhighlighter.php";i:12;s:25:"wp-cumulus/wp-cumulus.php";i:13;s:27:"wp-pagenavi/wp-pagenavi.php";}'; $b = unserialize($a); print_r($b); $c = [ 'accelerated-mobile-pages/accelerated-moblie-pages.php', 'akismet/akismet.php', 'classic-editor/classic-editor.php', 'contact-form-7/wp-contact-form-7.php', 'disable-google-fonts/disable-google-fonts.php', 'golang-brush-for-syntaxhighlighter-evolved/syntaxhighlighter-GoBrush.php', 'hueman-addons/ha-fire.php', 'light/light.php', 'nimble-builder/nimble-builder.php', 'regenerate-thumbnails/regenerate-thumbnails.php', 'syntaxhighlighter/syntaxhighlighter.php', 'wp-pagenavi/wp-pagenavi.php' ]; print_r($c); $d = serialize($c); print_r($d); exit; ?>
Array ( [0] => accelerated-mobile-pages/accelerated-moblie-pages.php [1] => akismet/akismet.php [2] => classic-editor/classic-editor.php [3] => contact-form-7/wp-contact-form-7.php [4] => disable-google-fonts/disable-google-fonts.php [5] => golang-brush-for-syntaxhighlighter-evolved/syntaxhighlighter-GoBrush.php [6] => hueman-addons/ha-fire.php [7] => light/light.php [8] => nimble-builder/nimble-builder.php [9] => regenerate-thumbnails/regenerate-thumbnails.php [10] => syntaxhighlighter/syntaxhighlighter.php [11] => wp-pagenavi/wp-pagenavi.php ) a:12:{i:0;s:53:"accelerated-mobile-pages/accelerated-moblie-pages.php";i:1;s:19:"akismet/akismet.php";i:2;s:33:"classic-editor/classic-editor.php";i:3;s:36:"contact-form-7/wp-contact-form-7.php";i:4;s:45:"disable-google-fonts/disable-google-fonts.php";i:5;s:72:"golang-brush-for-syntaxhighlighter-evolved/syntaxhighlighter-GoBrush.php";i:6;s:25:"hueman-addons/ha-fire.php";i:7;s:15:"light/light.php";i:8;s:33:"nimble-builder/nimble-builder.php";i:9;s:47:"regenerate-thumbnails/regenerate-thumbnails.php";i:10;s:39:"syntaxhighlighter/syntaxhighlighter.php";i:11;s:27:"wp-pagenavi/wp-pagenavi.php";}
UPDATE `shuijingwanwq`.`wp_options` SET `option_value`='a:12:{i:0;s:53:"accelerated-mobile-pages/accelerated-moblie-pages.php";i:1;s:19:"akismet/akismet.php";i:2;s:33:"classic-editor/classic-editor.php";i:3;s:36:"contact-form-7/wp-contact-form-7.php";i:4;s:45:"disable-google-fonts/disable-google-fonts.php";i:5;s:72:"golang-brush-for-syntaxhighlighter-evolved/syntaxhighlighter-GoBrush.php";i:6;s:25:"hueman-addons/ha-fire.php";i:7;s:15:"light/light.php";i:8;s:33:"nimble-builder/nimble-builder.php";i:9;s:47:"regenerate-thumbnails/regenerate-thumbnails.php";i:10;s:39:"syntaxhighlighter/syntaxhighlighter.php";i:11;s:27:"wp-pagenavi/wp-pagenavi.php";}' WHERE `option_id`=35;
10、还原第 2 步骤的更改后,再次刷新页面,显示正常。
近期评论