php redis 连接问题
给我你的怀抱
给我你的怀抱 2017-05-16 13:08:41
0
4
665


为什么我打印phpinfo()函数时,显示是有redis扩展的(如上图),但是我调用extension_loaded('Redis')的方法时,返回false。导致不能使用new Redis()连接redis。 但是我是可以使用Predis连接redis的,这是什么原因啊。 关于Redis 与Predis连接有什么区别啊。如果分别使用这两种连接方式,分别需要安装什么东西,求大神指点。

给我你的怀抱
给我你的怀抱

reply all (4)
伊谢尔伦

This is equivalent to installing the redis client, and you have to install the redis server on the server side!

    仅有的幸福

    This means that your PHP has already installed the redis extension, and you also need to install redis.

      Ty80

      Useclass_exists('Redis')instead to determine whether the extension is loaded successfully. The problem you encounter may be a bug. The redis extension you installed is still the RC version

        刘奇

        Your screenshot shows that the redis extension has been installed, namely phpredishttps://github.com/phpredis/p...

        phpredis是用C写的php扩展,需要编译安装。predis是用php写的php扩展,直接使用,laravel 默认的就是predis
        You said the connection cannot be made, you can post the error to see

          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!