php - RedisLab 与 WordPress 集成错误:PHP 警告:Redis::select() 期望参数 1 为整数

标签 php wordpress caching redis phpredis

我正在尝试为我的 WWrdPress 站点添加一个 Redis 对象现金服务器。我正在关注这个 article我在 redislabs.com 中创建了帐户

根据教程,我的 object-cache.php 文件有

 define("WP_REDIS_BACKEND_HOST", "HOST_URL");
 define("WP_REDIS_BACKEND_PORT", "12345");
 define("WP_REDIS_BACKEND_DB", "DATABAES_NAME");
 define("WP_REDIS_PASSWORD", "PA$$WORD");

347         $this->redis->auth( $redis['password'] );
348
349         if ( isset( $redis['database'] ) ) {
350           $this->redis->select( $redis['database'] );
351         }

但是我在第 350 行遇到了这个错误

错误

[Sun Apr 30 19:54:30.579728 2017] [:error] [pid 1750] [client 162.158.26.98:21176] PHP Warning: Redis::select() expects parameter 1 to be integer, string given in /var/www/public/wordpress/wp-content/object-cache.php on line 350, referer: mysite.com/about-us/

我该如何解决这个问题?

最佳答案

Redis Cloud 和其他有责任感的 Redis 即服务提供商仅支持默认数据库名称(或 0)。只需从文件中删除第 349-351 行,或 define("WP_REDIS_BACKEND_DB", 0); 你应该没事。

关于php - RedisLab 与 WordPress 集成错误:PHP 警告:Redis::select() 期望参数 1 为整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43710846/

相关文章:

php - 我的 Telegram 查询出了什么问题?

php - 更改登录语言

C# ServiceStack.Redis 在 hashmap 中存储对象

java - 将 PHP SoapClient 与 Java JAX-WS RI(Web 服务)结合使用

php - 是否可以知道变量在哪里设置?

jquery - 如何在购物车更新时更新购物车中的附加属性?

css - 菜单对齐- wordpress

带 SSL 的 WordPress

performance - AppFabric缓存-正确使用DataCacheFactory和DataCache

Python文件缓存