在mac os下怎么安装 swoole的教程 新(2019)
前言:最近在研究 swoole 卡在 安装环境上 从网上搜到的大多数教程 尝试安装都已经失效了 一直没找到原因 直到今天才找到原因
第一种方法 brew instal swoole 这个因为 brew 已经弃用 swoole 所以这种方法 无法安装 。
第二种方法先安装 现在mac 系统下安装 pecl 安装教程详见我写的另一篇博客 http://blog.szwyll.com/archives/859 然后使用 pecl 安装 命令如下:
pecl install swoole
问题就出现在这里首先在刚开始安装的时候 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:
导致后面 最后找不到php.config.h文件
然后查资料这些文件在 xcode的开发sdk中有然后 我就开始建立软链接 注意我的系统版本是 macosx 10.14 所以sdks后面是10.14
sduo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include /usr/include
结果报错
ln: /usr/iclude: Operation not permitted
明明我已经使用了sudo 为啥还会出现 下面这个哥们遇到跟我一样问题 下面回答都没答到重点上
https://segmentfault.com/q/1010000003882420/a-1020000003910085
继续google 发现有人说到苹果在全新的 OS X El Capitan 10.11 10.12系统上已经使用了 Rootlees /system /sbin /usr 目标被加锁了 使用root权限也无法访问
查看方法: csrutil status 检查状态 发现确实打开了
关闭方法:重启电脑开后按住 Command-R 进入恢复分区. 然后在 实用工具 栏找到 终端启动运行. 输入:csrutil disable; reboot
然后重新运行 pecl install swoole
当然要把 extension=swoole.so 加到 php.ini

运行 php –ri swoole
