Home > Backend Development > PHP Tutorial > redis的php客户端装配

redis的php客户端装配

WBOY
Release: 2016-06-13 12:53:52
Original
910 people have browsed it

redis的php客户端安装

1.下载phpredis

https://github.com/nicolasff/phpredis


2.解压文件

unzip phpredis-master.zip


3.安装

/usr/local/php5/bin/phpize

./configure --with-php-config=/usr/local/php5/bin/php-config

make

make install


4.修改php.ini配置文件(vi /etc/php.ini)

加入一行:

extension=/home/lengzijian/downloads/phpredis-master/modules/redis.so(可以放在方便的位置)


5.重启apache或者nginx

/etc/init.d/httpd restart


6.查看phpinfo



7.编写测试代码

<?php $redis = new Redis();
$redis->connect('127.0.0.1',6379);
$redis->set('name','lenzijian');
echo $redis->get('name');
?>
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