The website randomly went down and I can't figure out how to correct the following error. I have tried toggling all plugins, the server was recently updated to PHP 7.4
from PHP 7.3
but no other website has had this issue.
My Setup:
PHP - PHP 7.4.11 (cli) (built: Oct 8 2020 17:32:43)
uname - Debian 4.19.146-1 (2020-09-17) x86_64 GNU/Linux
MySQL - mysql Ver 15.1 Distrib 10.3.23-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Error from the website:
Fatal error: Uncaught Error: Call to undefined function wp_cache_add() in /WEBSITE_PATH/wp-includes/option.php:258 Stack trace: #0 /WEBSITE_PATH/wp-includes/functions.php(1717): wp_load_alloptions() #1 /WEBSITE_PATH/wp-includes/load.php(664): is_blog_installed() #2 /WEBSITE_PATH/wp-settings.php(159): wp_not_installed() #3 /WEBSITE_PATH/wp-config.php(99): require_once('/home/swcsoldie...') #4 /WEBSITE_PATH/wp-load.php(37): require_once('/home/swcsoldie...') #5 /WEBSITE_PATH/wp-blog-header.php(13): require_once('/home/swcsoldie...') #6 /WEBSITE_PATH/index.php(22): require('/home/swcsoldie...') #7 {main} thrown in /WEBSITE_PATH/wp-includes/option.php on line 258
Fatal error: Uncaught Error: Call to undefined function wp_cache_add() in /WEBSITE_PATH/wp-includes/option.php:258 Stack trace: #0 /WEBSITE_PATH/wp-includes/option.php(116): wp_load_alloptions() #1 /WEBSITE_PATH/wp-includes/l10n.php(69): get_option() #2 /WEBSITE_PATH/wp-includes/l10n.php(137): get_locale() #3 /WEBSITE_PATH/wp-includes/l10n.php(828): determine_locale() #4 /WEBSITE_PATH/wp-includes/class-wp-fatal-error-handler.php(46): load_default_textdomain() #5 [internal function]: WP_Fatal_Error_Handler->handle() #6 {main} thrown in /WEBSITE_PATH/wp-includes/option.php on line 258
Code from Line 258:
wp_cache_add( 'alloptions', $alloptions, 'options' );
An undefined function
error in PHP is fatal error, and means you're calling a function that doesn't exist (at least, at the point and scope it's being called at). Most often, I'd wager 9/10 times, this happens while you're developing and you mistype a function name, str_repace
instead of str_replace
, for instance.
With all of that being said, wp_cache_add()
is a WordPress Core function defined in /wp-includes/cache.php
, and is being called by a core file: /wp-includes/option.php
on line 258.
Since these core files, and core functions are triggering a fatal "undefined function" error, it means your WordPress installation is failing somewhere. It possibly got corrupted during an update of some kind - it's infrequent, but it does happen for any number of reasons.
To fix this: try reinstalling WordPress, as it is absolutely compatible with PHP 7.4 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.