ashokostech
ashokostech

Reputation: 317

PHP 8.1 Redis session handler issue

Warning: ini_set(): Session save handler "redis" cannot be found on my page where I have use the code as shown below

ini_set('session.save_handler', 'redis');

This code works fine if the PHP version is 7.4 but when I upgraded PHP to PHP8 or PHP8.1 it stops working and gives me a warning "Warning: ini_set(): Session save handler "redis" cannot be found"

Also when I run the phpinfo() I do not find any PHP extension for Redis which is visible in case of PHP7.4

Upvotes: 1

Views: 2739

Answers (1)

vladvildanov
vladvildanov

Reputation: 7

It looks like redis extension isn't available at your php modules. Check by using this command:

php -m | grep redis

So if it's empty, you need to install and configure it properly:

  1. Visit this link to check how to install php redis extension.
  2. Open your php.ini file (php --ini to check location)
  3. Check for extension_dir property and make sure it points to correct extensions directory.
  4. Add this code below - extension=redis.so
  5. Restart your PHP-FPM service

Now try it once more:

php -m | grep redis

Should return redis now. Now ini_set command should work!

Upvotes: 1

Related Questions