Swoole源码安装

2019-11-29  本文已影响0人  皮蛋馅儿

一、Swoole源代码地址,执行git clone命令克隆源代码或者直接下载压缩包
二、生成configure
1、切换到swoole源代码根目录

cd swoole-src-4.4.12

2、找到PHP安装目录bin下的phpize,我的PHP安装目录为/home/soft/php,执行以下命令

/home/soft/php/bin/phpize
image.png

如果出现以下错误,说明没有生成configure文件,原因是没有安装autoconf,这时候需要安装一下


image.png
yum -y install autoconf

3、configure

./configure --with-php-config=/home/soft/php/bin/php-config
image.png

如果出现:configure: error: in /mnt/share/swoole-src-4.4.12': configure: error: C++ preprocessor "/lib/cpp" fails sanity check Seeconfig.log' for more details
原因:出现该情况是由于c++编译器的相关package没有安装,执行以下安装

yum install glibc-headers
yum install gcc-c++

4、执行make命令

make
image.png
make test

5、执行make install,到对应目录下可看到swoole.so扩展

make install
image.png

6、到第5步已经完成了swoole的源码安装,接下来是实现PHP7支持swoole,编辑php.ini,添加extension=swoole扩展,保存退出,php -m查看一下swoole是否已经加载


image.png
php -m
image.png

加我微信公众号【皮蛋馅儿】,一起学习哦~

上一篇 下一篇

猜你喜欢

热点阅读