php - Cannot find save handler 'redis'

323

I am running a PHP 5.4 hosted Web App on Azure. To manage session handling I have configured a Redis cache instance on Azure.

I have set the session save path & handler:

session.save_handler = redis
session.save_path = "tcp://kbcache.redis.cache.windows.net:6379?auth=***"

I have also configured the Redis extensions:

PHP_EXTENSIONS  bin\php_igbinary.dll
APPSETTING_PHP_EXTENSIONS   bin\php_igbinary.dll
PHP_EXTENSIONS02    bin\php_redis.dll
APPSETTING_PHP_EXTENSIONS02 bin\php_redis.dll

However when I browse to my website I receive the message:

Warning: session_start(): Cannot find save handler 'redis' - session startup failed in D:\home\site\wwwroot\index.php(22) : eval()'d code on line 2

What am I missing?

745

Answer

Solution:

[Update Pre post]

When deployed PHP project, we need enable extensions on Azure. Please see my website folder structure:

enter image description here

I copied the DLL files into folder namedext. And those dlls' version should be VC9 and non-thread-safe (nts) compatible.

enter image description here

And I created aextension.ini into folder nameini. The content as following :

extension=d:\home\site\ext\php_igbinary.dll
extension=d:\home\site\ext\php_redis.dll
zend_extension=d:\home\site\ext\php_xdebug-2.3.3-5.4-vc9-x86_64.dll
session.save_handler = redis
session.save_path = "tcp://**.redis.cache.windows.net:6379?auth=**

At last, I add the "PHP_INI_SCAN_DIR" Configurtation Panel on Azure portal:

enter image description here

It works for me.

81

Answer

Solution:

Actually, I tried PHPRedis extension on my environment, it works fine.

Form your description, I think you made configuration of Redis extensions complicated.

I followed those steps:

1.Switch toPHP version 5.4

2.Download PHPRedis extension form this page. Since I used PHP which version isversion 5.4 TS, I downloadedphpredis_5.4_vc9_ts

3.After unzipped the download file, Please copy those DLL file into your PHPext folder. It seems that you need pay attention to this point.

Add this code into yourPHP.ini file

extension=php_igbinary.dll
extension=php_redis.dll

session.save_handler = redis
session.save_path = "tcp://**.redis.cache.windows.net:6379?auth=**

4.Create a Page and test Redis Code:

$redis=new Redis();
$redis->pconnect('tcp://**.redis.cache.windows.net', 6379);
$redis->auth('**+**=');
$redis->set('key', 'hello '); 
$redis->append('key', 'world '); 
echo $redis->get('key');
169

Answer

Solution:

had similar issues. make sure redis dll file is there and enabled in php.ini also make sure that redis folder has full write permissions.

People are also looking for solutions to the problem: mysql - Issue uploading WebM files using PHP

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.