CentOS7 安装PHP7 phpredis扩展报错解决方法

php7编译安装phpredis扩展报一下错误的解决办法:
[root@iZ95uu0skeq19sZ phpredis]# make && make install
/bin/sh /usr/local/src/redis-stable/phpredis-master/libtool --mode=compile cc -I. -I/usr/local/src/redis-stable/phpredis-master -DPHP_ATOM_INC -I/usr/local/src/redis-stable/phpredis-master/include -I/usr/local/src/redis-stable/phpredis-master/main -I/usr/local/src/redis-stable/phpredis-master -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/redis-stable/phpredis-master/redis.c -o redis.lo
mkdir .libs
cc -I. -I/usr/local/src/redis-stable/phpredis-master -DPHP_ATOM_INC -I/usr/local/src/redis-stable/phpredis-master/include -I/usr/local/src/redis-stable/phpredis-master/main -I/usr/local/src/redis-stable/phpredis-master -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/redis-stable/phpredis-master/redis.c -fPIC -DPIC -o .libs/redis.o
In file included from /usr/local/src/redis-stable/phpredis-master/redis.c:27:0:
/usr/local/src/redis-stable/phpredis-master/common.h:3:40: 致命错误:ext/standard/php_smart_str.h:没有那个文件或目录
#include <ext/standard/php_smart_str.h>
^
编译中断。
make: *** [redis.lo] 错误 1
解决办法:因为最新的 phpredis 分了几大分支,针对最新的PHP稳定发行版 php7 有专门为php7的分支,所以我们从github拉下phpredis 源码 需要切换到PHP7的分支 首先git clone phpredis下来

git clone https://github.com/nicolasff/phpredis

git checkout php7

/usr/local/php7/bin/phpize   #找不到phpize的路径可用whereis命令查看:whereis phpize 得到路径

./configure --with-php-config=/usr/local/php/bin/php-config #此处为php-config的路径,可用whereis php-config查看路径

make && make install


Build complete.
Don't forget to run 'make test'.

然后看到了等字样,就说明安装成功了

©️2020 CSDN 皮肤主题: 书香水墨 设计师:CSDN官方博客 返回首页