文章:http://www.runoob.com/redis/redis-install.html
文章:https://www.xiabingbao.com/php/2017/08/27/window-php-redis.html
1.到redis下載版本 並解壓縮
https://github.com/MicrosoftArchive/redis/releases
本次下載的是 C:\website\Redis-x64-3.2.100
2.CD到Redis目錄
//利用 Redis Desktop Manager 查看資料 //1.啟動 redis-server.exe redis.windows.conf 開啟另一個服務窗 //2.連入redis redis-cli -h host -p port -a password redis-cli -h 127.0.0.1 -p 6379 -a "mypass" redis-cli //3.設定值 set myKey abc //4.取得值 get myKey
PHP使用Redis擴展方法
一樣使用上面安裝Redis-x64-3.2.100
1.下載php ext擴展dll
php_igbinary.dll和php_redis.dll
(1) php_igbinary.dll: php_igbinary-2.0.1-5.6-ts-vc11-x64.zip
https://windows.php.net/downloads/pecl/releases/igbinary/2.0.1/
(2).php_redis.dll:php_redis-2.2.7-5.6-ts-vc11-x64.zip
https://windows.php.net/downloads/pecl/releases/redis/2.2.7/
2.將兩個dll檔案放到php/ext下,並在php.ini 追加以下兩條
extension=php_igbinary.dll
extension=php_redis.dll
3.重啟apache
c:\Apache24\bin\httpd -k restart
4.創建一個test.php檔案,測試是否擴展成功
phpinfo(); $redis = new Redis(); $redis->connect('127.0.0.1', 6379); echo "Connection to server sucessfully"; echo "Server is running: " . $redis->ping();
畫面上應該會顯示phpinfo()確定是不是有redis資訊且顯示
Connection to server sucessfullyServer is running: +PONG
沒有留言:
張貼留言