下载php-redis
https://nodeload.github.com/nicolasff/phpredis/zip/master
tar -zxvf phpredis-master.zip
解压phpredis-master.zip
//进入到解压目录中
cd phpredis-master
//执行phpize 扩展检测 ,phpize 是你安装的php 文件目录==> usr/local/php/sbin/phpize (自己的php安装目录)
/usr/local/Cellar/php/7.2.9_2/bin/phpize
如下图所示:

//你自己安装php php-config 路径,下面是我的php 安装php-config的路径,换成你自己的路径就ok

执行下面命令
./configure --with-php-config=/usr/local/Cellar/php/7.2.9_2/bin/php-config
下面检测 扩展安装需要的信息

//编译
sudo make

//安装
sudo make install

扩展redis.so文件安装到目录 /usr/local/Cellar/php/7.2.9_2/pecl/20170718/文件中

找到你PHP.ini 文件配置
php -i |grep php.ini 可以查看php.ini所在的位置

然后打开php的配置文件,默认在/etc/php.ini,增加下列代码
extension=redis.so

查看是否成功安装redis扩展
执行命令 php -m 找到redis 说明你安装成功了
php -m 查看所有成功安装的php扩展模块

网友评论