I’ve been given a site that I need to install on my server. The site was made by someone else and it seems to have redis installed.
I get errors such as (paths altered/truncated in the error msg for privacy reasons):
Fatal error: Uncaught Error: Class ‘Redis’ not found in
wp-contentobject-cache.php:732 Stack trace: #0
wp-contentobject-cache.php(171): WP_Object_Cache->__construct() #1
wp-includesload.php(638): wp_cache_init() #2 wp-settings.php(131):
wp_start_object_cache() #3 wp-config.php(94):
require_once(‘path…’) #4 wp-load.php(37):
require_once(‘pathgree…’) #5 wp-blog-header.php(13):
require_once(‘path…’) #6 index.php(17): require(‘path…’)
#7 {main} thrown in wp-contentobject-cache.php on line 732
What’s really odd is that they didn’t give me the WP codebase, just the wp-content folders with theme, plugins, uploads.
So the entire wp codebase, wp-config etc are all defaults that I’ve just obtained from the current latest version at WordPress.org.
So if the wp-config is as default, how can some redis like system be coming into play? I’ve never had this issue before and transferred 101 pre-build WP sites between servers.
To clarify, I don’t want Redis enabled so I need to stop WP thinking that it’s present as it won’t be on the new server. Can anyone assist ?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The file wp-content/object-cache.php is one of the dropins – PHP files with custom code that are not plugins. It is used when you are using a persistent object cache plugin, and it will be loaded automatically.
Normally the plugin will create that file. But if you move all the files without the plugin, the code in that file doesn’t work anymore, and you get your error message.
So you either have to delete the file, or install the plugin again. In this case probably the Redis Object Cache plugin.
Method 2
You will need to make sure so you have the redis php extension installed and enabled. You can check the list of installed modules using:
php -m | grep redis
Make sure the extension is enabled:
sudo phpenmod redis
To install the redis extension:
sudo apt-get install php-redis
Depending on how php is configured and running you might have to restart your webserver and/or php-fpm service:
sudo service apache2 restart sudo service php7.3-fpm restart
Of course you would have to change to above to match your environment.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0