標籤:
-->安裝Redis服務
下載redis安裝包 http://pan.baidu.com/s/1pJiVFHx
下載後解壓 把解壓後檔案夾裡面的檔案(根據自己的系統位元選擇32位或者64位)拷貝到D盤建立的檔案夾,並重新命名為redis
按"Windows + R" 輸入cmd 開啟命令列工具
--> d: (進入D盤)
--> cd redis (進入redis目錄)
--> redis-server.exe redis.conf (啟動redis服務)
測試redis是否安裝成功
--> 新開啟一個命令列 cmd
--> d: (進入D盤)
--> cd redis (進入redis目錄)
--> redis-cli.exe (進入redis命令操作)
--> set test "Hello World"
--> get test
如果成功列印出 Hello World 表示Redis安裝成功
-->安裝PHP Redis 擴充
下載php_redis.dll擴充(要下載和當前使用的PHP版本對應的擴充檔案,我用的是php 5.5)
http://pan.baidu.com/s/1mgInDZM
下載後解壓 有32位和64位區分 選擇對應的解壓 把解壓後的檔案放到PHP安裝包下的ext檔案夾中 D:/wamp/bin/php/php5.5.12/ext
php_igbinary.dll php_redis.dll 兩個檔案
然後開啟php.ini
輸入:
extension=php_igbinary.dll
php_redis.dll
順序也要這樣,然後重啟apache服務
在開發目錄寫一個php檔案測試一下:
<?php
$redis = new Redis();
$redis->connect(‘127.0.0.1‘,6379);
$redis->set(‘test‘,‘hello redis‘);
echo $redis->get(‘test‘);
?>
輸出hello redis 說明安裝成功了。
推薦一個可視化的Redis工具
http://pan.baidu.com/s/1c08u2Lq
傻瓜式安裝就可以,開啟後點擊Connect to Redis Server 輸入名稱和IP地址 連結後就可以看到效果。
Redis + php擴充的安裝與配置(windows)