侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

swoole mac编译错误怎么办

swoole  /  管理员 发布于 5年前   452

swoole mac编译错误怎么办?mac 安装 swoole 可能会出现的错误

请先看完之后再操作

一、用pecl安装swoole(没有安装起来)

2018年4月,由于homebrew的变动,导致无法使用brew install的方式安装php的扩展,现在改为用pecl安装,pecl安装swoole的方法为:

pecl install swoole

出现在选项要填yes还是no

可能出现的报错及解决方法

1 fatal error: ‘openssl/ssl.h‘ file not found

解决方法1:cp -R /usr/local/opt/openssl/include/openssl /usr/local/include

解决方法2:ln -s /usr/local/opt/openssl/include/openssl /usr/local/include/openssl

原因:一般用brew安装的软件,都会把需要include的文件自动放到/usr/local/include里的,但是不知为什么安装openssl的时候没有放到那里,所以要自己拷过去,其实最好的方法是做一个链接,即用解决方法2!

2 error: Cannot find libpq-fe.h. Please confirm the libpq or specify correct PostgreSQL(libpq) installation path

解决方法 brew reinstall PostgreSQL

原因:可能是没有安装PostgreSQL

3 fatal error: ‘hiredis/hiredis.h‘ file not found

出现这个原因绝大多数是因为没有安装hiredis,用brew search hiredis看看有没安装,没有安装直接用brew install hiredis安装后,再次pecl install swoole就可以

细心的童鞋会发现,brew install hiredis后,/usr/local/include里,多了一个hiredis,而且这个是一个软链,链接到/usr/local/Cellar/hiredis/0.13.3/include/hiredis

结果还是报错,没有搞定,能力有限.

二、换了个方式 安装swoole(完美解决)

2.1 下载swoole

sudo pecl download swoole

2.2 编译安装

tar zxvf swoole-4.2.12.tgz    // 注意自己下载的版本,可能不一定cd swoole-4.2.12phpize./configure --enable-openssl --enable-http2 --enable-sockets --enable-mysqlnd -with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s/make clean && make && sudo make install

2.3 遇到报错

mkdir: /usr/local/Cellar/[email protected]/7.1.30/pecl: File existsmkdir: /usr/local/Cellar/[email protected]/7.1.30/pecl: No such file or directorymake: *** [install-modules] Error 1// 大致意思就是 pecl  文件夹存在,但是打不开// 我的pecl是软连接过来的 不知道为什么打不开

2.4 解决方法

修改 /usr/local/Cellar/[email protected]/7.1.30/bin/php-config

extension_dir=‘/usr/local/Cellar/[email protected]/7.1.30/pecl/20160303‘ 中的 『pecl』 换成 『lib/php』extension_dir=‘/usr/local/Cellar/[email protected]/7.1.30/lib/php/20160303‘

2.5 重新编译

./configure --enable-openssl --enable-http2 --enable-sockets --enable-mysqlnd -with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s/make clean && make && sudo make install

2.6 添加 swoole.so

修改php.ini 在文件末尾 加一行

extension = "/usr/local/Cellar/[email protected]/7.1.30/lib/php/20160303/swoole.so"

mac安装swoole 真是疼

以上就是swoole mac编译错误怎么办的详细内容,更多请关注其它相关文章!


  • 上一条:
    swoole怎么部署
    下一条:
    php json转换相关知识(小结)
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • swoole协程通信之数据处理协程对数据进行读写,保存到协程上下文示例(0个评论)
    • swoole redis连接池应用优化之多协程频繁访问redis(0个评论)
    • php中使用hyperf框架调用讯飞星火大模型实现国内版chatgpt功能示例(2个评论)
    • php中使用hyperf框架调用文心千帆大模型实现国内版chatgpt功能示例(0个评论)
    • 在hyperf框架中使用基于protobuf的RPC生成器实现rpc服务(1个评论)
    • 近期文章
    • 在go中实现一个常用的先进先出的缓存淘汰算法示例代码(0个评论)
    • 在go+gin中使用"github.com/skip2/go-qrcode"实现url转二维码功能(0个评论)
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • Laravel从Accel获得5700万美元A轮融资(0个评论)
    • 在go + gin中gorm实现指定搜索/区间搜索分页列表功能接口实例(0个评论)
    • 在go语言中实现IP/CIDR的ip和netmask互转及IP段形式互转及ip是否存在IP/CIDR(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2017-09
    • 2020-03
    • 2020-06
    • 2021-03
    • 2021-04
    • 2021-05
    • 2021-07
    • 2021-08
    • 2021-09
    • 2021-11
    • 2022-03
    • 2022-05
    • 2023-01
    • 2023-02
    • 2023-03
    • 2023-07
    • 2023-08
    • 2023-11
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客