0

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-content\object-cache.php:732 Stack trace: #0 wp-content\object-cache.php(171): WP_Object_Cache->__construct() #1 wp-includes\load.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('\path\gree...') #5 wp-blog-header.php(13): require_once('\path\...') #6 index.php(17): require('\path\...') #7 {main} thrown in wp-content\object-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 ?

2
  • 1
    Is there a file wp-content/object-cache.php? If so, delete it.
    – fuxia
    Commented Sep 19, 2020 at 22:10
  • Thank you @fuxia thats it, feel free to write an answer if you want some credits.
    – AdamJones
    Commented Sep 20, 2020 at 20:09

2 Answers 2

2

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.

0

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.

6
  • This is what I'd seen other suggest in other posts. What I dont understand is how redis is being required by WordPress. It isn't a requirement of the system so what has enabled it? I want to disable it as I won't have redis on the destination platform to start with.
    – AdamJones
    Commented Sep 20, 2020 at 13:33
  • redis is not a dependency in Wordpress, but it seems to be either configured to use redis or perhaps you are using some kind of caching plugin which does. Commented Sep 20, 2020 at 14:14
  • I've removed all plugins. As stated, I have default wp-config. This is the core of my question, what is making redis think it needs to run?
    – AdamJones
    Commented Sep 20, 2020 at 16:54
  • Have you removed the wp-content/object-cache.php file? This file will be auto loaded if it exists in the wp-content folder and it is using redis. Commented Sep 20, 2020 at 16:57
  • Thats it thank you! I should give this to @ fuxia though as he wrote this first. I just didnt see it.
    – AdamJones
    Commented Sep 20, 2020 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.