Search code examples
phpredisphpredis

How to use Redis in php?


I installed redis 2.8.12 and configured phpredis. Then I called redis instance in php class. But there is no result, can you help me?

public function __construct() {

        try {
            echo ':) ';
            $newRedis = new Redis();
            echo ':P ';
        }
        catch (Exception $e) {
            echo $e -> getMessage();
        }



    }

this printed :), not printed :P


Solution

  • Did you check if your php redis module is loaded by checking in phpinfo() ? Also, if your redis server is running properly and on which port and if configured using password you are supplying same while initiating the connection ?