安裝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: [email protected] 1.1.1d is already installed and up-to-date
To reinstall 1.1.1d, run `brew reinstall [email protected]`

那肯定是openssl位置沒找到,重新執行:

pecl install swoole

在openssl指定其位置

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

查詢一下安裝成功

➜  ~ php --ri swoole

swoole

Swoole => enabled
Author => Swoole Team <[email protected]>
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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章