PHP Redis 安装

PHP Redis 安装

 

文章出处:http://netkiller.github.io/

 

20.4.4. php-redis.x86_64 : Extension for communicating with the Redis key-value store

20.4.4.1. pecl 安装

pecl install redis

20.4.4.2. yum安装

https://github.com/nicolasff/phpredis

yum search redis

php-redis.x86_64 : Extension for communicating with the Redis key-value store
python-redis.noarch : A Python client for redis
redis.x86_64 : A persistent key-value database

20.4.4.3. 源码编译安装

安装git版本控制客户端

yum install git

从github仓库中克隆一份代码到本地

git clone git://github.com/nicolasff/phpredis.git

编译安装phpredis; 我暂时没有找到 pecl的phpredis源

cd phpredis
phpize
./configure --with-php-config=/srv/php-5.4.9/bin/php-config
make && make install

创建配置文件

扫描二维码关注公众号,回复: 1201633 查看本文章

20.4.4.4. 配置 redis.ini

cat > /srv/php-5.4.9/etc/conf.d/redis.ini <<EOF
extension=redis.so
EOF

查看安装情况

# php -m | grep redis
redis

20.4.4.5. Session 配置

使用 Redis 存储 Session 数据

session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379"
或者使用多个redis
session.save_path = "tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&timeout=2.5, tcp://host3:6379?weight=2"

猜你喜欢

转载自netkiller-github-com.iteye.com/blog/1901773