解决 php的session无法保存到redis
php的session写入redis配置
vim /etc/php-fpm.d/www.conf
user = nginx
group = nginx
php_value[session.save_handler] = Redis
php_value[session.save_path] = ‘tcp://192.168.1.2:6688‘
php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache
vim /etc/php.ini
session.save_handler = redis
session.save_path = "tcp://192.168.1.2:6688“
但是我刷新验证码时,再去查看redis的key值是,发现是空的,没往里面写
连接redis,查看session的key值
redis-cli -h 192.168.1.2 -p 6688
192.168.1.2:6688> keys * #查看所有key值
(empty list or set)
192.168.1.2:6688> quit #退出
rpm -qa |grep php 时,发现安装的php的redis的扩展包安装的是php70-php-pecl-redis-3.1.6-1.el6.remi.x86_64
而我安装的版本是php70w
解决方法:
yum search php70w
Yum install php70w-pecl-redis.x86_64 -y
原文地址:http://blog.51cto.com/8999a/2061722
时间: 2024-10-09 12:52:05