mac 安装或升级swoole v4.2.2版本

4 篇文章 0 订阅
2 篇文章 0 订阅

直接升级可能会带来一些问题。如异步redis、http2等之前没有编译。

1、swoole升级:pecl upgrade swoole

2、查看版本:php --ri swoole | grep Version

 

如果你需要解决问题向下看,下面我们来重新安装并编译一些功能项:

下载swoole最新版本

swoole-swoole-v4.2.2.zip

编译:

1、phpize

2、./configure --enable-coroutine --enable-openssl  --enable-http2  --enable-async-redis --enable-sockets --enable-mysqlnd

3、make && make install

 

注意:openssl、nghttp2、hiredis需要安装拓展文件

1、openssl

如果你安装则需要 "拷贝openssl文件夹" 到swoole v4.2.2[找自己文件实际目录]/include/ 下。

找到你们的openssl文件夹,把它拷贝到swoole安装包下的include下面,我的openssl文件的目录为/usr/local/opt/openssl/include 把这个路径下的openssl文件夹copy到安装文件夹中的include下就ok了。

如果还是报错修改环境变量:

.profile

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

source ~/.profile

 

2、http2安装

下载文件nghttp2

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

2、tar -jxvf nghttp2-1.30.0.tar.bz2

3、cd nghttp2-1.30.0

4、./configure

5、make && make install

如果没报错则表示安装nghttp2成功。

3、hiredis安装

问题描述:

安装swoole时,
想启用异步redis功能,
于是添加了 –enable-async-redis 选项,
但是在编译时出错,
提示“hiredis/hiredis.h: No such file or directory”

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

解决办法也很简单,
安装 hiredis 即可

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 && make install

添加环境变量

vi ~/.profile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
在最后一行添加
然后运行:source ~/.bash_profile

 

重新编译swoole安装。

编译:

1、phpize

2、./configure --enable-coroutine --enable-openssl  --enable-http2  --enable-async-redis --enable-sockets --enable-mysqlnd

3、make && make install

 

augdais-MacBook-Pro:swoole-v4.2.2 augdai$ php --ri swoole | grep Version

Version => 4.2.2

结束。

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值