Reputation: 23
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?
Upvotes: 2
Views: 7028
Reputation: 1
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.
Upvotes: 0
Reputation: 1207
[Update Pre post]
When deployed PHP project, we need enable extensions on Azure. Please see my website folder structure:
I copied the DLL files into folder named ext
. And those dlls' version should be VC9 and non-thread-safe (nts) compatible.
And I created a extension.ini
into folder name ini
. 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:
It works for me.
Upvotes: 1
Reputation: 1207
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 to PHP version 5.4
2.Download PHPRedis extension form this page.
Since I used PHP which version is version 5.4 TS
, I downloaded phpredis_5.4_vc9_ts
3.After unzipped the download file, Please copy those DLL file into your PHP ext
folder. It seems that you need pay attention to this point.
Add this code into your PHP.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');
Upvotes: 0