swoole之环境安装(mac)

一、前置工作
1.php安装
brew install php71
brew link --force php@7.1
上述操作完成后,就已经安装好了php7.1版本,同时可以通过pecl install xxx安装相应的扩展
便捷命令
php -v 查看版本
php -m |grep redis 查看支持的某个扩展功能
php --ini 查看配置文件路径
2.依赖安装
brew install openssl
brew install nghttp2
3.安装命令
sudo pecl download swoole
tar zxvf swoole-4.2.12.tgz
cd swoole-4.2.12
phpize
./configure --enable-openssl --enable-http2 --enable-sockets --enable-mysqlnd -with-openssl-dir=/usr/local/Cellar/openssl/1.0.2q/
make clean && make && sudo make install
为什么不直接
sudo pecl install swoole
上述命令安装的过程中,依赖支持会报如下错误
1.fatal error: 'openssl/ssl.h' file not found
2.#error "Enable openssl support, require openssl library."
搜遍全网的解决方案,openssl安装在/usr/local/opt/include下,通过映射到/usr/local/include下,这样可以解决问题1,但是会出现问题2,这个时候愣是没找到解决方案,只能最原始的用上述方案解决。
 

原文地址:https://www.cnblogs.com/jaky666/p/10290230.html