Class 'redis' Not Found

Hello.

We trying use Redis for session backend. When in config.local.php I set $config['session_backend'] = 'redis'; then I have error: Class 'Redis' not found at store\app\Tygh\Backend\Session\Redis.php, line: 200

Please help.

Regards,

Alex.

Hello.

We trying use Redis for session backend. When in config.local.php I set $config['session_backend'] = 'redis'; then I have error: Class 'Redis' not found at store\app\Tygh\Backend\Session\Redis.php, line: 200

Please help.

Regards,

Alex.

It looks like Redis is not installed on your server

If you are using Ubuntu, you can run:

sudo apt-get install redis-server -y
You need to install redis support from PHP.
pecl install redis
and add redis.so into your php configuration.

If you are using Ubuntu, you can run:

sudo apt-get install redis-server -y
You need to install redis support from PHP.
pecl install redis
and add redis.so into your php configuration.

Thanks all for help! Yes, OS is Ubuntu. But we use AWS and session_redis_server is not localhost, I set it to another host that AWS provided (.....usw2.cache.amazonaws.com). Port is default for redis 6379. Or we can use Redis only on the same server?

You have the option to assign a redis server. You could point to your other redis server. I would put IP address instead of domain name.

$config['cache_redis_server'] = 'localhost';
$config['cache_redis_global_ttl'] = 0; // set this if your cache size reaches Redis server memory size
// Storage backend for sessions. Available backends: database, redis
$config['session_backend'] = 'redis';
$config['session_redis_server'] = 'localhost'

Ok, but I still not understand why error here (line 200, and error that class not found but not that can't connect to Redis)???

So in __construct in line 50 we call connect method line 59.

[attachment=12497:Ashampoo_Snap_2017.07.20_20h27m03s_001_.jpg]

And then in the connect method I have this error on line 200.

[attachment=12498:Ashampoo_Snap_2017.07.20_20h27m25s_002_.jpg]

Ashampoo_Snap_2017.07.20_20h27m03s_001_.jpg

Ashampoo_Snap_2017.07.20_20h27m25s_002_.jpg

First, if you are using another server, make sure redis port is open in your firewall and that its limited to whatever server is using it.

From the CLI, run "redis-cli" and type "ping". You should see a pong back. Later you can use redis-cli with "monitor" to see all is working.

From CLI run your PHP with the -m option. It will tell you if redis is loaded at master. "php -m" will use whatever install is default. If you use a custom path, like 7.0 or something, type out the whole bin "/path/to/php -m".

If there is no redis.so, do a system search for "redis.so". Sometimes it gets installed outside of a PHP install being used.If its not there, install it from PECL or whatever other method. If it is there, you can symlink it to the modules directory of whatever custom PHP path you use, and match the permissions to other modules there.

Finally, ensure any applicable app is able to use it. You made have to enable/write in an extension=redis.so in your preferred php.ini (or redis.ini include). You can include it twice, but it will fill logs with extension already loaded errors.

Good luck :)

Thanks for so very detailed answer, it's helped!!! The issue was because in PHP not installed Redis extension.

First, if you are using another server, make sure redis port is open in your firewall and that its limited to whatever server is using it.

....