WordPress 升级遇到下述错误讯息:
- WordPress故障排除:这个网站发生严重错误。
- 请检查网站管理员电子邮件收件匣以取得相关说明
要怎么解决呢?
WordPress 升级遇到“这个网站发生严重错误”的解法
WordPress 遇到“这个网站发生严重错误。”的问题,会附上下述连结:
这个连结提供的解法,大多数都没有用,里面唯一一个重点就是把 WordPress 安装的 Plugin 都先关掉(直接操作数据库)
- 找出 Table wp_options 的 option_name Key 是 active_plugins 的
- 然后将 option_value 字段内容改成 'a:0:{}'
操作步骤:
- mysql> select * from wp_options where option_name like 'active_plugins%'; # 找到这个
- mysql> select option_id from wp_options where option_name like 'active_plugins%'; # 只有一笔资料,所以抓 id 来操作比较保险,假设 option_id = 1
- $ mysql -u root -p wordpress_db -e "select option_value from wp_options where option_id = 1 > optoin_value_backup.dump # 先将内容备份
- mysql> update wp_options set option_value = 'a:0:{}' where option_id = 1;
- 到此应该就可以去看是否能正常显示了,不过我的是到此还是坏的,所以采用下述还原步骤:
- 资料还原:$ mysql -u root -p wordpress_db -e "update wp_options set option_value = '`cat optoin_value_backup.dump`' where option_id = 1; # cat optoin_value_backup.dump 可以自己复制贴上
上述无法解决,只好开始下一步,找 WordPress 如何 Debug,可见下述:
官方文件说可以开启 Debug mode,如下述步骤:
- vim /$WordPress_DIR/wp-config.php # 找到此行:
define('WP_DEBUG', false);修改并加入下述内容
// define('WP_DEBUG', false);
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true); - 注:官方可以开启更多 Debug 讯息,完整内容如下: (我只用到上述即可)
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true ); - 存盘后,就可以在 wp-content/debug.log 看到 debug.log 档
- debug.log 里面就会说,有哪个 Plugin 的程式内容是有问题的,去把程式注解掉,或者去 wp-content/plugins/ 去把那个 Plugin 先搬走试试看
- 我是先把程式注解掉,然后也把他搬走,能正常开启后台画面后,再把他搬回去,再来将此外挂于界面删掉,在手动由线上安装最新版,到此就恢复正常囉~