环境安装版本:
Swoole 2.1.3
hiredis 0.13.3
phpredis 3.1.6
phpds 1.2.4
phpinotify 2.0.0
sd 3.1.11
- 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
解决方案:
安装command line tool就自动配置好Unix开发环境
在命令行执行命令:xcode-select --install
参考资料:
grep: /usr/include/php/main/php.h: No such file or directory
macOS 中使用 phpize 动态添加 PHP 扩展的错误解决方法
mac 10.11 phpize 报错问题 - 编译Swoole报错:
swoole.h:414:10: fatal error: 'openssl/ssl.h' file not found #include <openssl/ssl.h>
原因:
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
这个肯定能解决问题了
参考资料:
histMacOS 10.12.1 编译安装 Swoole 支持 openssl 模块错误处理 - 安装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
参考资料:
回退Mac上用Brew安装的PHP版本
brew 安装的东西设置启动建议使用这种方式
brew services start redis