源码下载

1
2
3
4
5
6
7
8
9
10
11
12
13
cd /usr/local/src

wget https://pecl.php.net/get/redis-4.1.1.tgz

tar zxvf redis-4.1.1.tgz

cd redis-4.1.1

phpize

./configure --with-php-config=/usr/local/bin/php-config

make && make install

修改php.ini配置

1
2
3
4
vim /usr/local/php7/etc/php.ini

# 增加redis扩展
extension=redis.so

重启php-fpm

1
2
3
4
systemctl restart php-fpm

# 检查扩展是否安装成功
php -m | grep redis