We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Class 'redis' not found

Use phalcon 3.1.1, php7.0.11, Redis 3.2.100

I have redis registered like so

use Phalcon\Cache\Backend\Redis;
use Phalcon\Cache\Frontend\Igbinary as FrontData;

$di->setShared('cache', function (){
    $frontCache = new FrontData(['lifetime' => 120]);
    $cache = new Redis($frontCache,[
        "host"       => '127.0.0.1',
        "port"       => 6379,
        "auth"       => '',
        "persistent" => false,
        "index"      => 0,
    ]);
    return $cache;
});

Using it like so:

        $copList = $this->cache->get('player_cop_list');

        if($copList === null)
        {
            $copList = Players::find("coplevel > '0'");
            $this->cache->save('player_cop_list', $copList, 900);
        }

but I get the error PHP Fatal error: Class 'redis' not found when running the code.



8.2k
Accepted
answer

Solved it by installing the php_redis extension https://pecl.php.net/package/redis