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

Error while connecting to Redis server with latest Phalcon 2.1.x build and PHP7

Hi,

I got the following error while connecting to Redis server with latest Phalcon 2.1.x build and PHP7. Can anyone help me? Thank you!

> 2016/03/22 23:25:40 [error] 28304#28304: *1 FastCGI sent in stderr: "PHP message: Could not connect to the Redisd server 127.0.0.1:6379
> #0 [internal function]: Phalcon\Cache\Backend\Redis->_connect()
> #1 [internal function]: Phalcon\Cache\Backend\Redis->get('4hd7una8pbl7b13...', 1800)
> #2 [internal function]: Phalcon\Session\Adapter\Redis->read('4hd7una8pbl7b13...')
> #3 [internal function]: session_start()
> #4 /var/www/secure.ania.internal/app/config/services.php(126): Phalcon\Session\Adapter->start()
> #5 [internal function]: Closure->{closure}()
> #6 [internal function]: Phalcon\Di\Service->resolve(NULL, Object(Phalcon\Di\FactoryDefault))
> #7 [internal function]: Phalcon\Di->get('session', NULL)
> #8 [internal function]: Phalcon\Di->getShared('session')
> #9 /var/www/secure.ania.internal/app/library/Auth/Auth.php(208): Phalcon\Di\Injectable->__get('session')
> #10 /var/www/secure.ania.internal/app/library/Auth/Auth.php(172): NedaGames\Auth\Auth->getIdentity()
> #11 /var/www/secure.ania.internal/app/plugins/SecurityPlugin.php(76): NedaGames\Auth\Auth->isUserSignedIn()
> #12 [internal functi...
> PHP message: PHP Fatal error:  Uncaught Phalcon\Cache\Exception: Could not connect to the Redisd server 127.0.0.1:6379 in phalcon/cache/backend/redis.zep:119
> Stack trace:
> #0 [internal function]: Phalcon\Cache\Backend\Redis->_connect()
> #1 [internal function]: Phalcon\Cache\Backend\Redis->save('4hd7una8pbl7b13...', '', 1800)
> #2 [internal function]: Phalcon\Session\Adapter\Redis->write('4hd7una8pbl7b13...', '')
> #3 {main}
edited Mar '16

You sure you have redis working on this port ? If yes then there is some bug in php7 + phalcon 2.1.x currently, is it working on php 5.6 ?



1.7k
Accepted
answer

I just found the reason. It was from selinux (Security-Enhanced Linux). I have disabled the selinux and now it works! :) Thanks for answer!