記WordPress報錯There has been a critical error on your website處理

打開自己網站發現這樣的報錯

There has been a critical error on your website. Please check your site admin email inbox for instructions.

Learn more about debugging in WordPress.

將WordPress根目錄 下wp-config.php中的define( 'WP_DEBUG', false );改為define( 'WP_DEBUG', true );再打開網站主頁報錯變為這樣

Fatal error: Uncaught Error: Class ‘Redis’ not found in /var/www/yyr.im/public/wordpress/wp-content/object-cache.php:539 Stack trace: #0 /var/www/yyr.im/public/wordpress/wp-content/object-cache.php(411): WP_Object_Cache->connectUsingPhpRedis(Array) #1 /var/www/yyr.im/public/wordpress/wp-content/object-cache.php(162): WP_Object_Cache->__construct(true) #2 /var/www/yyr.im/public/wordpress/wp-includes/load.php(580): wp_cache_init() #3 /var/www/yyr.im/public/wordpress/wp-settings.php(133): wp_start_object_cache() #4 /var/www/yyr.im/public/wordpress/wp-config.php(123): require_once(‘/var/www/yyr.im…’) #5 /var/www/yyr.im/public/wordpress/wp-load.php(37): require_once(‘/var/www/yyr.im…’) #6 /var/www/yyr.im/public/wordpress/wp-blog-header.php(13): require_once(‘/var/www/yyr.im…’) #7 /var/www/yyr.im/public/wordpress/index.php(17): require(‘/var/www/yyr.im…’) #8 {main} thrown in /var/www/yyr.im/public/wordpress/wp-content/object-cache.php on line 539

There has been a critical error on your website.

Learn more about debugging in WordPress.

以“Fatal error: Uncaught Error: Class ‘Redis’ not found”為關鍵字在網上搜索得知這樣的報錯一般是因為php的redis擴展沒有安裝,通過php -m命令查看確實沒看到redis擴展,但用pecl list命令查看redis擴展是已經被安裝的,所以應當是php沒有正確加載已安裝的redis擴展,最後在/etc/php/7.3/fpm/php.ini中添加extension=redis.so並通過systemctl restart php7.3-fpm命令重啟php服務,網站已經能正常打開了。

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *