1

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

ashokostech
  • 307
  • 1
  • 5
  • 11
  • NOTE:: I have macOS Monterey, the problem is I do not find any PHP extension of Redis for PHP81 Mac OS. One of my friends uses Ubuntu and is able to install the PHP Redis extension for PHP 8.1 so seems I need the extension for PHP8.1 on Mac OS – ashokostech Feb 01 '23 at 04:15

1 Answers1

1

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!