MAC安装、配置redis以及安装、配置phpredis扩展
2016-12-15 本文已影响1203人
踏云小子
一、安装
-
下载安装包 redis-3.2.6.tar.gz
官网地址:http://redis.io/download -
解压:tar -zvxf redis-3.2.6.tar.gz ,修改目录名为redis,将解压后的文件夹放到 /usr/local目录下
-
终端进入/usr/local/redis,然后执行如下命令:
sudo make
sudo make test
sudo make install
- 启动redis,输入:
redis-server
出现如下霸气页面,说明安装成功

二、启动redis客户端
这个位置真是奶奶的难找,居然在这里
/usr/local/bin/redis-cli
输入命令后显示如下结果说明启动成功

三、安装phpredis扩展
1.mac自带php安装phpredis
$ brew install homebrew/php/php56-redis #56为php版本5.6.X
2.安装包安装
- 首先git clone 项目到本地,切换到phpredis目录下
phpredis 的github地址:
https://github.com/nicolasff/phpredis
- 在shell中输入 phpize 然后 ./configure 进行配置

- 接下来就是最后的make 和make install了

- sudo make install

- 修改php.ini
sudo vim /etc/php.ini
在里面增加
extension_dir = "/usr/local/Cellar/php56/5.6.29_5/lib/php/extensions/no-debug-non-zts-20131226/"
extension = redis.so
(因为macOS Sierra 关闭的/usr/bin的权限,妈蛋的,所以不能直接把redis.so模块拷贝进/usr/lib/php/extensions/,所以不能不能用,忍不住吐槽,干嘛设置这鸟权限,我实在是被这卡死了,相关开启此权限,请看midmirror妹子的方法)
- 重启apache
sudo /usr/sbin/apachectl restart
提示
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable
你需要安装autoconf
brew install autoconf