Redis PHP缓存“ERR不允许”

时间:2013-06-06 23:53:05

标签: php wordpress caching redis phpredis

我正在努力让Redis front-end cache to Wordpress工作。我得到了这个致命的错误:

    2013-06-07 01:46:12: (mod_fastcgi.c.2701) FastCGI-stderr: PHP Fatal error:  Uncaught exception 'Predis\ServerException' with message 'ERR operation not permitted' in /home/www/predis/lib/Predis/Client.php:291
    Stack trace:
    #0 /home/www/predis/lib/Predis/Client.php(233): Predis\Client->onResponseError(Object(Predis\Command\HashExists), Object(Predis\ResponseError))
    #1 /home/www/index-with-redis.php(76): Predis\Client->__call('hexists', Array)
    #2 /home/www/index-with-redis.php(76): Predis\Client->hexists('7de22495a3e5275...', '3e3299d491f3bac...')
    #3 {main}
      thrown in /home/www/predis/lib/Predis/Client.php on line 291

我有一个正常运行的Redis服务器(用它运行其他项目)。出于某种原因,我得到ERR Not permitted。有任何想法吗?

1 个答案:

答案 0 :(得分:2)

就像你在评论中所说,问题是没有设置密码。对于将来看到此错误的任何人,您希望使用以下命令实例化您的客户端:

my_client = new Predis\Client(array(
            "host" => "some_host",
            "port" => "some_port",
            "password" => "some_pw",
            "database" => "some_db_number"
        )