先安装编译工具:yum install wget make gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel kernel keyutils patch perl
1、在 /usr/local/src目录下 下载:wget -c https://github.com/phpredis/phpredis/archive/php7.zip
2、解压:unzip php7.zip
3、进入目录:cd phpredis-php7
4、/usr/local/php/bin/phpize #用phpize生成configure配置文件 若这一步报错:Cannot find config.m4.
Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module
解决方法如下:到php的安装目录下如:cd /usr/local/php/php-7.0.4/ext/openssl 执行命令: cp ./config0.m4 ./config.m4 即可解决
注意:第五步执行一定是在扩展的目录下,不是php的安装目录
5、./configure --with-php-config=/usr/local/php/bin/php-config #配置
6、make #编译
make install #安装
7、修改php.ini配置文件在最后一行加入:extension="redis.so"
8、重启验证