最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

migration - Uncaught Error: Class 'Redis' errors on a site I've transfered to new hosting

programmeradmin6浏览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.

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 ?

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.

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 ?

Share Improve this question edited Sep 20, 2020 at 16:54 AdamJones asked Sep 19, 2020 at 22:02 AdamJonesAdamJones 3282 gold badges7 silver badges26 bronze badges 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
Add a comment  | 

2 Answers 2

Reset to default 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.

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.

发布评论

评论列表(0)

  1. 暂无评论