环境
操作系统: OS X EI Capitan 10.11.2
PHP版本:5.6.9
安装步骤
安装 redis
brew install redis
brew install autoconf
wget https://github.com/ijonas/dotfiles/raw/master/etc/redis.conf
sudo mv redis.conf /etc/redis.conf
redis-server /etc/redis.conf ##注意redis.conf 中指定 log 文件权限问题
redis-cli #启动 redis
install autoconf
安装 phpredis
https://github.com/nicolasff/phpredis
cd phpredis
sudo phpize
./configure
make
sudo make install
** 使 php 支持 redis**
修改 php.ini 配置文件
php --ini | grep 'loaded'
php.ini
查看是否安装成功
php -m | grep redis
php -i | grep 'Redis Support'
check redis
运行 demo 程序
<?php
//Connecting to Redis server on localhost
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$redis->set("tutorial-name", "Redis tutorial");
echo $redis->get("tutorial-name").chr(10);
参考
1、http://raphaelstolt.blogspot.jp/2010/05/installing-php-redis-extension-on-mac.html
2、http://www.tutorialspoint.com/redis/redis_php.htm
3、http://levi.yii.so/archives/2887