phpredis扩展安装
redis高速缓存,有链表排序功能,效率相当高,对创建内存级的模块业务关系很有用
下载phpredis
gitclonegit://github.com/nicolasff/phpredis.git
wgethttp://download.csdn.net/detail/wkupaochuan/5100016
yum -y install php-devel 安装php-devel软件包,可以执行phpize命令
phpize生成编译文件,即可以调用./configure命令
tar zxvf phpredis.tar.gz
cd phpredis-2.2.4
/usr/local/php/bin/phpize 用phpize生成congfigure配置文件,类似初始化
./configure --with-php-config=/usr/bin/php-config
make && make install编译安装
如果成功:在shell中输出生成的redis.so路径
在/etc/php.ini配置文件的extension_dir下面加入
extension_dir=" "上面生成的路径
extension=redis.so
验证:
重启php,重启web服务器,
/etc/init.d/php-fpm restart
service httpd restart
然后在phpinfo.php查看redis
<?php//连接本地的Redis服务$redis=newRedis();$redis->connect('127.0.0.1',6379);echo"Connectiontoserversucessfully";//查看服务是否运行echo"Serverisrunning:"+$redis->ping();?>
执行脚本,输出结果为:
ConnectiontoserversucessfullyServerisrunning:PONG
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。