redisphp
1.安装redis的php扩展linux
http://windows.php.net/downloads/pecl/releases/redis/git
http://windows.php.net/downloads/pecl/releases/igbinary/github
到这两个地址去选择下载相应的压缩包,解压出相应的.dll文件,而后放置到php的ext扩展文件夹里,而后修改php.ini,最后重启服务器便可redis
步骤:apache
1.打印phpinfo()出来windows
根据phpinfo()去选择下载的zip安全
2.解压缩后,将php_redis.dll和php_redis.pdb拷贝至php的ext目录下服务器
将php_igbinary.dll和php_igbinary.pdb拷贝至php的ext目录下测试
3.修改php.ini
nignx:
[redis]
extension=php_igbinary.dll
extension=php_redis.dll
apache:
; php_redis
extension=php_igbinary.dll
extension=php_redis.dll
4.重启服务器 查看phpinofo();
5.测试:
//链接本地的 Redis 服务
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
echo "Connection to server sucessfully";
//设置 redis 字符串数据
$redis->set("tutorial-name", "Redis tutorial");
// 获取存储的数据并输出
echo "Stored string in redis:: " . $redis->get("tutorial-name");
2.redis安装
1、下载windows版本的Redis
去官网找了好久,发现原来在官网上能够下载的windows版本的,如今官网以及没有下载地址,只能在github上下载,官网只提供linux版本的下载
官网下载地址:http://redis.io/download
github下载地址:https://github.com/MSOpenTech/redis/tags
2、安装Redis
1.这里下载的是Redis-x64-3.2.100版本,个人电脑是win7 64位,因此下载64位版本的,在运行中输入cmd,而后把目录指向解压的Redis目录。
二、启动命令
redis-server redis.windows.conf,出现下图显示表示启动成功了。
一、因为上面虽然启动了redis,可是只要一关闭cmd窗口,redis就会消失。因此要把redis设置成windows下的服务。
也就是设置到这里,首先发现是没用这个Redis服务的。
二、设置服务命令
redis-server --service-install redis.windows-service.conf --loglevel verbose
输入命令以后没有报错,表示成功了,刷新服务,会看到多了一个redis服务。
三、经常使用的redis服务命令。
卸载服务:redis-server --service-uninstall
开启服务:redis-server --service-start
中止服务:redis-server --service-stop
四、启动服务
五、测试Redis
安装测试成功。
这里只是作简单的安装,部署服务使用,更深刻的使用能够去redis中文网看看 http://www.redis.net.cn/ 博客园也有不少深刻使用方法,因为个人博客系统须要用到,作个抛砖引玉吧。
在下载的解压包里面有一份文档,有详细的说明,
3.安装redis管理软件
有软件包,直接打开便可
下载地址:https://pan.baidu.com/s/1Ew4RWZ_q1I-AFaVSCbl9AQ 密码:gquy
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
memcache
1.memcache的php扩展安装
https://github.com/nono303/PHP7-memcache-dll
到github上下载memcache压缩包,而后放到php的ext扩展文件夹里,修改php.ini,重启服务器
步骤:
1.查看phpinofo();
查看 phpinfo,编译器为MSVC14,且线程安全,如图9
根据编译器到GitHub选择下载相应zip
2.解压zip,将 php-7.0.x_memcache.dll 更名php_memcache.dll ,并复制到php的ext文件夹里
3.修改php.ini
Nginx:
[memcache]
extension=php_memcache.dll
Apache:
;memcache
extension=php_memcache.dll
4.重启服务器 查看phpinfo();
5.测试:
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>\n";
$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;
$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
echo "Store data in the cache (data will expire in 10 seconds)<br/>\n";
$get_result = $memcache->get('key');
echo "Data from the cache:<br/>\n";
var_dump($get_result);
2.安装memcache
有软件包,直接打开便可
下载地址:https://pan.baidu.com/s/1bv7bNKmZGW_JB2dR8DjUlA 密码:m1iy