brew link php56报错,在 Mac下安装 Swoole 和 SwooleDistributed 3.X 出现的问题整理

phpize运行报错

grep: /usr/include/php/main/php.h: No such file or directory

grep: /usr/include/php/Zend/zend_modules.h: No such file or directory

grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory

Configuring for:

PHP Api Version:

Zend Module Api No:

Zend Extension Api No:

原因:

文件在这个目录下:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include

编译Swoole报错:

swoole.h:414:10: fatal error: 'openssl/ssl.h' file not found

#include

原因:

openssl 未安装或 openssl 库不在标准位置中

解决方案:

1、确认是否安装了 openssl

brew search openssl

若未安装则执行命令brew install openssl进行安装

2、确认 openssl 库是否在标准位置中

ls /usr/local/include/openssl

No such file or directory

这就是问题所在了,找到 openssl/include/openssl 目录,并 cp 到 /usr/local/include 目录中。

ln -s /usr/local/Cellar/openssl/1.0.2o_1/include/openssl /usr/local/include/

一般情况下就可以解决该问题了。

但是,也可能会遇到很诡异的状况,上步没有解决问题,依然找不到 openssl/ssl.h 等文件

复制 openssl 源文件到 swoole 的源码目录中,编译就可以了。

cp -R /usr/local/Cellar/openssl/1.0.2o_1/include/openssl swoole-src-2.1.3/include

安装php72-redis扩展

➜ ~ brew search php72-redis

==> Searching local taps...

==> Searching taps on GitHub...

==> Searching blacklisted, migrated and deleted formulae...

No formula found for "php72-redis".

Closed pull requests:

Bump revision for php72-redis (https://github.com/Homebrew/homebrew-php/pull/4428)

php72-redis 3.1.2 (new formula) (https://github.com/Homebrew/homebrew-php/pull/4257)

enchant 2.2.0 (https://github.com/Homebrew/homebrew-core/pull/21807)

Add PHP 7.2.0-alpha.1 core formula (php72) (https://github.com/Homebrew/homebrew-php/pull/4211)

➜ ~ brew install php72-redis

Updating Homebrew...

==> Auto-updated Homebrew!

安装 hiredis 扩展

➜ ~ brew install hiredis

Updating Homebrew...

==> Auto-updated Homebrew!

Updated 1 tap (caskroom/cask).

No changes to formulae.

==> Downloading https://homebrew.bintray.com/bottles/hiredis-0.13.3.high_sierra.bottle.tar.gz

######################################################################## 100.0%

==> Pouring hiredis-0.13.3.high_sierra.bottle.tar.gz

/usr/local/Cellar/hiredis/0.13.3: 31 files, 189.4KB

安装 redis 和设置开机启动

brew install redis

# 开机启动redis命令

ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

回退Mac上用Brew安装的PHP版本

brew list

brew unlink php56

brew link php55

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值