1. 程式人生 > >Wamp安裝redis擴充套件和window安裝redis-service(此文只針對學習redis)

Wamp安裝redis擴充套件和window安裝redis-service(此文只針對學習redis)

1.wamp環境下擴充套件redis

首先確認自己php的版本(phpinfo()檢視:包括ts或nts版本,vc版本等) wamp擴充套件redis主要就是選對正確版本 下載後解壓把redis.dll檔案複製到php下ext目錄下,在php.ini新增extension=php_redis.dll,重啟apache服務,列印phpinfo()檢視擴充套件 配置正確截圖

2、接下來是安裝redis-service

redis-service相關檔案,主要檔案如圖(APIBridge.dll檔案非必須) 開啟cmd,執行redis-server.exe redis.window.conf
         這個視窗要保持開啟  關閉時redis服務會自動關閉  在開啟一個cmd 執行 redis-cli.exe -h 192.168.10.61 -p 6379(根據自己ip自行修改) 然後 set test haha get test 獲取到值就成功了 php檔案編寫如下指令碼
 $redis = new Redis();
 $redis->connect('127.0.0.1',6379);
 echo "Connection to server sucessfully";
 //檢視服務是否執行
 echo "Server is running: " . $redis->ping();
列印結果