WordPress 升級遇到「這個網站發生嚴重錯誤」的解法

WordPress 升級遇到下述錯誤訊息:

  • WordPress故障排除:這個網站發生嚴重錯誤。
  • 請檢查網站管理員電子郵件收件匣以取得相關說明

要怎麼解決呢?

WordPress 升級遇到「這個網站發生嚴重錯誤」的解法

WordPress 遇到「這個網站發生嚴重錯誤。」的問題,會附上下述連結:

這個連結提供的解法,大多數都沒有用,裡面唯一一個重點就是把 WordPress 安裝的 Plugin 都先關掉(直接操作資料庫)

  1. 找出 Table wp_options 的 option_name Key 是 active_plugins 的
  2. 然後將 option_value 欄位內容改成 'a:0:{}'

操作步驟:

  1. mysql> select * from wp_options where option_name like 'active_plugins%'; # 找到這個
  2. mysql> select option_id from wp_options where option_name like 'active_plugins%'; # 只有一筆資料,所以抓 id 來操作比較保險,假設 option_id = 1
  3. $ mysql -u root -p wordpress_db -e "select option_value from wp_options where option_id = 1 > optoin_value_backup.dump # 先將內容備份
  4. mysql> update wp_options set option_value = 'a:0:{}' where option_id = 1;
  5. 到此應該就可以去看是否能正常顯示了,不過我的是到此還是壞的,所以採用下述還原步驟:
  6. 資料還原:$ 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,如下述步驟:

  1. vim /$WordPress_DIR/wp-config.php # 找到此行:
    define('WP_DEBUG', false);

    修改並加入下述內容

    // define('WP_DEBUG', false);
    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);

  2. 註:官方可以開啟更多 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 );

  3. 存檔後,就可以在 wp-content/debug.log 看到 debug.log 檔
  4. debug.log 裡面就會說,有哪個 Plugin 的程式內容是有問題的,去把程式註解掉,或者去 wp-content/plugins/ 去把那個 Plugin 先搬走試試看
  5. 我是先把程式註解掉,然後也把他搬走,能正常開啟後台畫面後,再把他搬回去,再來將此外掛於界面刪掉,在手動由線上安裝最新版,到此就恢復正常囉~

作者: Tsung

對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料