Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Problem with Redis: Fatal error: Class 'redis' not found

I use modelsCache such way:

    $di->setShared('modelsCache', function () {
      $frontCache = new DataFrontend([
          'lifetime' => 3600 * 24 * 7
      ]);

      $redis = new \Phalcon\Cache\Backend\Redis($frontCache, [
          'host' => $this->get('config')->redis->host,
          'port' => $this->get('config')->redis->port,
          'auth' => $this->get('config')->redis->password
      ]);

      return $redis;
    });

and I got error:

    Fatal error: Class 'redis' not found in /home/www/apps/models/entities/Company/Company.php on line 421

This line is:

    $company = Company::findFirst([
            'cache' => 'company_cache_key'
    ]);

This code return true: ``` class_exists('\Phalcon\Cache\Backend\Redis'); ```

I suspect there is problem with some Phalcon Framework class which handle Redis. But I have no idea how to fix it. Other libraries which use Redis work fines, generally Redis server works good. Any idea?

I have no idea, only solution i have - check this code in cli using gdb and check which is previous call before fatal error in php enviroment.

I have no idea, only solution i have - check this code in cli using gdb and check which is previous call before fatal error in php enviroment.

Do You mean check line by line with xdebug?

Well, not sure if gdb will get this error, with him you can fine what is cuasing for example seg faults, maybe you will find what's causing fatal errors too.



4.1k
Accepted
answer

It's needed to install: apt-get install php5-redis