windows 上安装redis和windows上redis与php扩展
1.下载redis压缩包(自己选择想要的版本,1,2地址任意选一个)
下载window版本地址1:https://github.com/dmajkic/redis/downloads
下载window版本地址2:https://github.com/lennyhuanga/redis-windows/tree/master/downloads
php 扩展下载直接使用对应的版本(php版本有nts和ts版本 :怎么看,通过echo PHPinfo()
查看配置信息里面Zend Extension Build或者HP Extension Build对应值里面是否有ts或者nts自己选择)
http://windows.php.net/downloads/pecl/releases/igbinary/
http://windows.php.net/downloads/pecl/snaps/redis/
下载zip解压到指定目录通过
dos命令:cd /d e:/你们的redis解压的目录/
针对redist2.5以上版本dos命令
将redis默认实例加入windows服务:
redis-server.exe --service-install redis.windows.conf --loglevel verbose
默认实例服务启动:redis-server --service-start
默认实例服务关闭:redis-server --service-stop
默认实例卸载:redis-server --service-uninstall
安装多个实例
redis.windows1.conf文件是拷贝redis目录里面的redis.windows.conf文件改的名称
实例为redis1 (可以自己取名称):
prot 端口10001(自己给)
安装redis1 实例服务:redis-server --service-install redis.windows1.conf --service-name redis1 --port 10001
redis1 实例服务启动:redis-server --service-start --service-name redis1 redis.windows1.conf
redis1 实例服务停止:redis-server --service-stop --service-name redis1 redis.windows1.conf
redis1 服务卸载:redis-server --service-uninstall --service-name redis1 redis.windows1.conf
windows自带的处理命令
sc delete 服务名称来卸载服务
net start ServiceName(服务名称)
net stop ServiceName(服务名称)
php扩展安装
php_igbinary.dll
php_redis.dll
这两个文件放入你对应的PHP版本目录下的ext目录下:
在php.ini配置文件里面配置
extension=php_igbinary.dll
extension=php_redis.dll
输出php配置看一下有没有redis,有成功。
简单列子测试:必须先启动redis服务
$redis=new Redis(); $redis->connect('127.0.0.1',6379); $redis->auth('123456'); $redis->set('test','helloworld'); echo $redis->get('test');
作者:深圳 —— 赵天鑫
QQ:—— 330114067
出处:http://www.cnblogs.com/sztx/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步