安装swoole遇到的坑

2018-09-12  本文已影响0人  TerryLaravel

 安装swoole的官方文档地址:https://wiki.swoole.com/wiki/page/6.html

但是这个文档只给出了基本的安装步骤,并没详细解释遇到的问题,下两是最常见的两个问题的解决步骤

1. 在编译时出错,提示“hiredis/hiredis.h: No such file or directory”

这个原因是没有安装 hiredis导致。

解决办法也很简单,

安装 hiredis 即可(特别注意只能编译安装 ,yum安装 无效

wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz

mv v0.13.3.tar.gz hiredis-0.13.3.tar.gz

tar xzvf hiredis-0.13.3.tar.gz

cd hiredis-0.13.3

make&&makeinstall

添加环境变量

vim /etc/profile   在文件最后加上: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

source /etc/profile    使环境变量生效

2. 编译swoole的时候--enable-http2的时候报如下错误

In file included from /home/xmc/download/swoole-src-2.1.0/swoole_server.c:17:0: /home/xmc/download/swoole-src-2.1.0/php_swoole.h:142:2: 错误:#error "Enable http2 support, require nghttp2 library." #error "Enable http2 support, require nghttp2 library."

这是因为swoole的http2模块依赖nghttp2库所以安装nghttp2即可

特别注意只能编译安装 ,yum安装 无效

安装方式

wget https://github.com/nghttp2/nghttp2/releases/download/v1.30.0/nghttp2-1.30.0.tar.bz2 

tar -jxvf nghttp2-1.30.0.tar.bz2 

cd nghttp2-1.30.0 

./configure make && make install

从头开始安装一次swoole扩展即可

上一篇下一篇

猜你喜欢

热点阅读