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.

Error upgrading 1.3 to 2.0 REDIS

Hello , I updated my Phalcon from 1.3 to 2.0.6. In version 1.3 this code works fine:

    $di->set('session', function() {
        $session = new Phalcon\Session\Adapter\Redis(array(
            'path' => "tcp://XXX.XXX.157.108:6379?weight=1"
        ));
        @$session->start();
        return $session;
    });

Now my application displays this error:

'Could not connect to the Redisd server 127.0.0.1:6379' in phalcon/cache/backend/redis.zep:118

Why 127.0.0.1 ?



6.2k
Accepted
answer
edited Aug '15

It looks like this adapter was added to the actual Phalcon library itself as of 2.0.6, and you were previously using the Incubator version. I can't find the library documented anywhere, but it definitely exists: https://github.com/phalcon/cphalcon/blob/master/phalcon/session/adapter/redis.zep

It looks like usage would be something similar to

    $di->set('session', function() {
        $session = new Phalcon\Session\Adapter\Redis(array(
            'host' => 'XXX.16.157.108',
            'port' => 6379,
            'persistent' => true
        ));
        return $session;
    });


3.0k

Nice, thank you Mitchell :)

It looks like this adapter was added to the actual Phalcon library itself as of 2.0.6, and you were previously using the Incubator version. I can't find the library documented anywhere, but it definitely exists: https://github.com/phalcon/cphalcon/blob/master/phalcon/session/adapter/redis.zep

It looks like usage would be something similar to

   $di->set('session', function() {
       $session = new Phalcon\Session\Adapter\Redis(array(
           'host' => 'XXX.16.157.108',
          'port' => 6379,
          'persistent' => true
       ));
       return $session;
   });