Home  >  Article  >  Backend Development  >  配置php的redis扩展

配置php的redis扩展

WBOY
WBOYOriginal
2016-06-23 14:28:49771browse

PHP技术交流群 170855791

PHP有多个redis的扩展程序,我本人使用的是phpredis扩展

首先下载扩展程序PhpRedis,下载地址:https://github.com/nicolasff/phpredis

解压后既可安装扩展程序

进入phpredis目录,执行以下命令:

phpize./configuremake && make install

注:phpize命令存放在php安装文件的bin文件夹下,如我的php安装在/usr/local/php文件夹中,可以使用一下命令

/usr/local/php/bin/phpize./configuremake && make install

执行完成以后命令会自动将生成的redis.so文件复制到php目录下,此时只需要修改php配置文件既可,添加下面指定到php配置文件中

extension=redis.so

重新启动apache

查看phpinfo(),包含redis,说明配置成功

PhpRedis支持session管理,可以通过修改php配置文件告诉redis如何存储session

session.save_handler = redissession.save_path = "tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&timeout=2.5, tcp://host3:6379?weight=2"

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
Previous article:Linux下编译安装PHPNext article:PHP导出Excel方法