首页 > 代码库 > 在MAC上搭建Redis环境

在MAC上搭建Redis环境

1. 首先更新Macports,然后安装redis

    sudo port selfupdate

    sudo port upgrade outdated

    sudo port install redis

    

    // 启动redis server

    sudo redis-server

    // 关闭redis server

    sudo pkill -9 redis-server


2. 安装php的redis extension

    cd /usr/local

    sudo mkdir src

    cd /usr/local/src

    sudo mkdir phpredis-build

    cd phpredis-build

    sudo git clone --depth 1 https://github.com/nicolasff/phpredis.git 

    cd phpredis

    sudo phpize

    sudo ./configure

    sudo make

    sudo make install


3. 添加生成的redis.so添加到php.ini

    例如:

    extension=/usr/lib/php/extensions/no-debug-non-zts-20100525/redis.so


启动Apache或者nginx后,用phpinfo会看到如下信息:

wKioL1PnspLSvd6FAADmiXElNRk677.jpg


本文出自 “Roket的空间” 博客,请务必保留此出处http://roketruan.blog.51cto.com/5114948/1538405