php 安裝redis擴展

PHP使用redis擴展php

 

一.php安裝redis擴展
 
1.使用phpinfo()函數查看PHP的版本信息,這會決定擴展文件版本
 
 
 

2.根據PHP版本號,編譯器版本號和CPU架構,redis

選擇php_redis-2.2.5-5.6-ts-vc11-x64.zip和php_igbinary-1.2.1-5.5-ts-vc11-x64.zip

下載地址:windows

http://windows.php.net/downloads/pecl/releases/redis/2.2.7/架構

http://windows.php.net/downloads/pecl/releases/igbinary/2.0.1/函數

 
 
3.解壓縮後,將php_redis.dll和php_igbinary.dll拷貝至php的ext目錄下
 
 

4.修改php.ini,在該文件中加入:.net

; php_redisserver

extension=php_igbinary.dllblog

extension=php_redis.dllip

注意:extension=php_igbinary.dll必定要放在extension=php_redis.dll的前面,不然此擴展不會生效
 
 
 
5.重啓Apache後,使用phpinfo查看擴展是否成功安裝
 

新建一個test.php頁面get

<?php
    $redis = new Redis();
    $redis->connect('127.0.0.1',6379);
    $redis->set('test','hello redis');
    echo $redis->get('test');
?>
 
hello redis
 
6. 要在Windows中使用redis須要下載Windows版的redis軟件

 

7. 在windows中讓redis開機自啓動:

   redis-server --service-install redis.windows-service.conf --loglevel verbose

相關文章
相關標籤/搜索