Home > Backend Development > PHP Tutorial > PHP Redis 装配

PHP Redis 装配

WBOY
Release: 2016-06-13 12:43:00
Original
957 people have browsed it

PHP Redis 安装

?

PHP Redis 安装

?

目录:[?-?]

  • 20.4.4.?php-redis.x86_64 : Extension for communicating with the Redis key-value store
  • 20.4.4.1.?pecl 安装
  • 20.4.4.2.?yum安装
  • 20.4.4.3.?源码编译安装
  • 20.4.4.4.?配置 redis.ini
  • 20.4.4.5.?Session 配置

?

文章出处: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
Copy after login

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
Copy after login

20.4.4.3.?源码编译安装

安装git版本控制客户端

yum install git
Copy after login

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

git clone git://github.com/nicolasff/phpredis.git
Copy after login

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

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

创建配置文件

20.4.4.4.?配置 redis.ini

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

查看安装情况

# php -m | grep redis
redis
Copy after login

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"
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template