- 安装MAMP PRO,下载地址
根据情况自行选择版本下载 - 下载编译对应版本的php源码,解压改名为php,将文件夹放到
/Applications/MAMP/bin/php/php5.6.37/include/ 路径下 - 执行以下命令
cd /Applications/MAMP/bin/php/php5.6.37/include/php
./configure
- 若出现报错:
configure: error: Please specify the install prefix of iconv with --with) 则执行第5步 brew install libiconv - 将phpredis下载到php的源码文件夹,由于使用git下载的是最新版,项目php版本较低。进入下载地址选择对应版本下载
- 进入redis下载目录(以2.2.8为例):
cd redis-2.2.8 执行以下命令:
/Applications/MAMP/bin/php/php5.6.37/bin/phpize
./configure --with-php-
config=/Applications/MAMP/bin/php/php5.6.37/bin/php-config
make
-
生成redis.so文件,将其放在/Applications/MAMP/bin/php/php7.3.8/lib/php/extensions/no-debug-non-zts-xxxxxxxx 文件夹里 -
在MAMP PRO中修改php.ini配置,  -
找到extension。增加一行代码extension=redis.so  -
在MAMP PRO中重启服务,查看phpinfo,如下图所示,证明已经配置完成 
|