今天在我的Ubuntu16.04 64bit LTS操作系统上的PHP7.2.3上使用pecl安装swoole的时候报错:
In file included from /tmp/pear/temp/swoole/swoole.c:16:0: /tmp/pear/temp/swoole/php_swoole.h:122:2: error: #error "Enable openssl support, require openssl library." #error "Enable openssl support, require openssl library." ^ In file included from /tmp/pear/temp/swoole/swoole.c:16:0: /tmp/pear/temp/swoole/php_swoole.h:133:2: error: #error "Enable http2 support, require nghttp2 library." #error "Enable http2 support, require nghttp2 library." ^ Makefile:194: recipe for target 'swoole.lo' failed make: *** [swoole.lo] Error 1 ERROR: `make' failed
不要下载 https://github.com/swoole/swoole-src/releases 上的打包文件,因为 build.sh 的内容如下:
原来 thirdparty 里面包含了几个 git 子模块:
我们直接 clone 一份:git clone https://github.com/swoole/swoole-src.git
然后切换到 v4.0.4 这个已经发布的 tag,git checkout v4.0.4
接着使用 sudo ./build.sh
#这句不正确=>若openssl还是报错,需要安装libssl-dev,命令:sudo apt install libssl-dev openssl
然后在重新 configure --with-openssl-dir=,接着我们去 openssl 官网下载最新版的 openssl 库(目前最新: https://www.openssl.org/source/openssl-1.1.0i.tar.gz),
然后使用 ./configure & make & make install 就可以使用 openssl
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!