Mac 安装 Swoole 出现 Enable openssl support, require openssl library 的解决办法
最开始是用pecl的方式安装的
pecl install swoole
想开启openssl 但是报错了
然后又用源码安装
wget https://github.com/swoole/swoole-src/archive/v4.4.12.tar.gz
tar -xzf v4.4.12.tar.gz
cd swoole-src-4.4.12
phpize
./configure --enable-openssl --enable-sockets --enable-http2 --enable-mysqlnd
也报错了,说是找不到openssl库
error: "Enable openssl supoort, require openssl library"
开始以为 OpenSSL 没有安装,结果发现并不是
sunmoon@sunmoons-mac:~$ brew install openssl
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.
Warning: openssl@1.1 1.1.1d is already installed and up-to-date
To reinstall 1.1.1d, run `brew reinstall openssl@1.1`
最后忽然想起来制定下 OpenSSL
的路径就好了
brew
安装的 OpenSSL
默认在 /usr/local/Cellar/openss/版本号
我的是 1.0.2t
, 因此路径为 /usr/local/Cellar/openssl/1.0.2s
./configure --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s --enable-sockets --enable-http2 --enable-mysqlnd
之后就可以愉快的 make && make install
了。
完成后查看一下是否安装成功
php --ri swoole
swoole
Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.4.12
Built => Dec 17 2019 08:23:01
coroutine => enabled
kqueue => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.0.2s 28 May 2019
http2 => enabled
pcre => enabled
zlib => 1.2.11
brotli => 16777223/16777223
mysqlnd => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.display_errors => On => On
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.unixsock_buffer_size => 262144 => 262144
swoole.use_shortname => Off => Off