一.安装redis扩展
下载redis扩展包以及解压
1
2
|
wget https://github.com/edtechd/phpredis/archive/php7.zip
unzip php7.zip
|
进入解压后目录,编译安装
1
2
|
cd data/pkg/phpredis-php7
/usr/local/php/bin/phpize
|
出现问题
1
2
3
4
5
|
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
#安装autoconf
yum install autoconf
|
开始编译
1
|
/usr/local/php/bin/phpize
|
查找php-config
1
|
find / -name php-config
|
配置环境
1
|
./configure –with-php-config=/usr/local/php/bin/php-config
|
编译安装
1
|
make & make install
|
配置php.ini,添加redis.so扩展
1
2
|
vim /usr/local/php/etc/php.ini
extension=redis.so
|
重启php-fpm
1
2
|
killall php-fpm
/usr/local/sbin/php-fpm
|
二.安装swoole扩展
克隆swoole
1
|
git clone https://gitee.com/swoole/swoole.git
|
安装swoole且编译
1
2
3
4
|
cd swoole
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config
make && make install
|
配置php.ini,添加swoole.so扩展
1
2
|
vim /usr/local/php/etc/php.ini
extension=swoole.so
|
重启php-fpm
1
2
|
killall php-fpm
/usr/local/sbin/php-fpm
|
推荐教程:PHP视频教程
以上就是php编译安装扩展redis及swoole的详细内容