很簡單隻須要3步,主要是安裝redis和安裝php的redis擴展兩個方面(安裝玩以後應該進行必定配置php
1.Windows安裝包下載地址:https://github.com/ServiceStack/redis-windows(注意,不少地址是linux的安裝包,沒有exe文件) https://github.com/mythz/redis-windowshtml
windows安裝redis,推薦博客:http://www.cnblogs.com/xshang/p/3800205.html,我按照次安裝成功。linux
2.去下載php相應版本的dell文件, 安裝extension=php_igbinary.dll擴展, 放入php的ext目錄下git
3.配置php:(注意保持這個順序)
extension=php_igbinary.dll
extension=php_redis.dllgithub
成功,查看phpinfo()信息。redis
--------------------------------建議使用如下安裝方法將redis安裝爲服務,而後設置自啓動windows
1,在redis的目錄下執行(執行後就做爲windows服務了)memcached
redis-server --service-install redis.windows.conf
2,安裝好後須要手動啓動redis測試
redis-server --service-start
3,中止服務spa
redis-server --service-stop
4,卸載redis服務
redis-server --service-uninstall
//--------------詳細步驟----------------------------------------------------------------
在window下安裝redis,首先下載redis,解壓放到一個目錄下,好比D:\redis\
在控制檯下切換到D:\redix
輸入:redis-server.exe redis.conf
而後從新打開一個cmd控制檯,仍然切換到D:\redis\下
輸入:redis-cli.exe -h 127.0.0.1 -p 6379
以後就可使用了,好比繼續輸入:set test "hello world"
接着輸入 get test
就會返回 hello world
--------------------------------------------------------------------------------------------------------
在php下使用redis,要用到php_redis.dll,下載對應版本,放到php下的ext目錄下,而後
須要配置php.ini,加入extension=php_redis.dll
在查看須要php_redis哪一個版本時,能夠用
<?php echo phpinfo(); ?>進行測試
而後,重啓wamp
再用
<?php echo phpinfo(); ?>測試
看到redis時,表示安裝成功了
http://www.runoob.com/memcached/window-install-memcached.html下載
一、下載memcache的安裝包,要選擇win環境的安裝包
二、把解壓後放到D盤(以D:/memcached爲例)
三、點擊開始=》運行=》輸入cmd進入dos界面。
四、輸入 d: 命令進入d盤,輸入 cd memcached 命令進入memcached文件夾
五、輸入 memcache.exe –d install 命令安裝,輸入memcache.exe –d start 啓動memcached進程。中止命令 memcached.exe -d stop, 卸載命令memcached.exe -d unistall
六、進入任務管理器,查看進程,以下圖則安裝成功:memcached.exe
七、下載 php_memcache.dll擴展文件,放到wamp安裝目錄下的bin\PHP\php5.5.12\ext目錄下
八、打開php.ini,加入 extension=php_memcache.dll ,注意前面沒有分號,保存後從新啓動服務
九、在本地新建項目memcached,添加index.php執行文件,輸入代碼以下:
$memcache=new Memcache();
$memcache->connect('127.0.0.1',11211);
$memcache->add('name2','fesfarige',false,60);
$val=$memcache->get('name2');
echo $val;
成功則輸出fesfarige
e:\phpToStudy\memcached> memcached.exe -m 1 -d start
(2). 中止memcached:
memcached.exe -d stop
(3). 卸載memcached:
memcached.exe -d uninstall