I want to set php.ini to use Redis as session handler. I did it this way:
session.save_handler = redis session.save_path = tcp://172.17.0.2:6379
My Php application and Redis are running in 2 different containers. This is the code I’m trying to run in Php:
<?php if(!isset($_SESSION)){ session_start(); } ?>
Due to my searchs I found that I should install:
sudo apt-get install php5-redis
but E: Unable to locate package php5-redis
I’ve also tried: php-redis
, php7-redis
, php7.4-redis
and the same result.
Resutls for apt-cache search php | grep -i redis
is:
libphp-predis - Flexible and feature-complete PHP client library for the Redis key-value store
What’s wrong?
Advertisement
Answer
You need use the pecl
to install redis:
pecl install redis
More details is here
If you are using docker insert into Dockerfile:
RUN pecl install redis && docker-php-ext-enable redis