安装PHP的swoole扩展报错解决方案

pecl install swoole

安装swoole,下载完成会提示:

enable sockets supports? [no] : yes
enable openssl support? [no] : yes
enable http2 support? [no] : yes
nable mysqlnd support? [no] :

会提示报错:

In file included from /private/tmp/pear/temp/swoole/php_swoole_cxx.cc:1:
In file included from /private/tmp/pear/temp/swoole/php_swoole_cxx.h:19:
In file included from /private/tmp/pear/temp/swoole/php_swoole.h:53:
/private/tmp/pear/temp/swoole/include/swoole.h:620:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make: *** [php_swoole_cxx.lo] Error 1
ERROR: `make' failed

我的系统是Mac,安装openssl会提示已安装:

➜  ~ brew install openssl
Updating Homebrew...
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位置没找到,重新执行:

pecl install swoole

在openssl指定其位置

enable sockets supports? [no] : yes
enable openssl support? [no] : yes --with-openssl-dir=/usr/local/opt/openssl@1.1
enable http2 support? [no] : yes
nable mysqlnd support? [no] :

查询一下安装成功

➜  ~ php --ri swoole

swoole

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.4.16
Built => Mar 11 2020 18:15:36
coroutine => enabled
kqueue => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1d  10 Sep 2019
http2 => enabled
pcre => enabled
zlib => 1.2.11
brotli => E16777223/D16777223
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 262144 => 262144

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值