二十一、PHP中应用Redis
cd /usr/local/src
wget http://pecl.php.net/get/redis-2.2.5.tgz
tar xf redis-2.2.5.tgz
cd redis-2.2.5
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make ; make install
mv /usr/local/php/lib/php/extensions/no-debug-zts-20100525/redis.so /usr/lib64/
vim /usr/local/php/php.ini
extension_dir = /usr/lib64/
extension = redis.so
usr/local/php/bin/php -m | grep redis
redis
## 加载成功,可以重启 nginx 看看 phpinfo 页
二十二、Redis实现session共享
php.ini中加入
session.save_handler = "redis"
session.save_path = "tcp://127.0.0.1:6379"
或者apache虚拟主机加入
php_value session.save_handler "redis"
php_value session.save_path "tcp://127.0.0.1:6379"
或者php-fpm.conf对应的pool中加入
php_value[session.save_handler] = redis
php_value[session.save_path] = " tcp://127.0.0.1:6379 "
共同学习,写下你的评论
评论加载中...
作者其他优质文章