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

redis的php客户端装配

WBOY
WBOYOriginal
2016-06-13 12:53:52909browse

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');
?>





Statement:
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