search

Home  >  Q&A  >  body text

php redis connection problem

< br>Why when I print the phpinfo() function, it shows that there is a redis extension (as shown above), but when I call the extension_loaded('Redis') method, it returns false. As a result, new Redis() cannot be used to connect to redis. But I can use Predis to connect to redis. What is the reason? What is the difference between Redis and Predis connections? If you use these two connection methods respectively, what needs to be installed respectively? Please give me some advice.

给我你的怀抱给我你的怀抱2782 days ago760

reply all(4)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-16 13:10:41

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

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-16 13:10:41

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

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 13:10:41

    Use class_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

    reply
    0
  • 怪我咯

    怪我咯2017-05-16 13:10:41

    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

    reply
    0
  • Cancelreply