Dockerfile
RUN apt-get update -y
RUN apt-get install -y libssl-dev
RUN cd /tmp/ && rm -rf ./swoole-src
&& curl -o ./swoole.tar.gz https://github.com/swoole/swoole-src/archive/master.tar.gz -L
&& tar zxvf ./swoole.tar.gz
&& mv swoole-src* swoole-src
&& cd swoole-src
&& phpize
&& ./configure --enable-openssl --with-openssl-dir=/usr/lib/ssl --enable-http2
&& make && make install
&& docker-php-ext-enable swoole
虽然已经装过openssl了,但缺少对应的lib,找半天才知道需要装libssl-dev(centos是openssl-devel)
安装过程收获
openssl version -a
这篇博客详细记录了在Dockerfile中安装Swoole扩展的过程,包括遇到的openssl依赖问题及解决办法。通过运行一系列命令,如下载Swoole源码、配置编译选项、安装libssl-dev等,最终成功启用Swoole扩展。文章强调了在安装过程中需要注意的依赖库和配置选项,对于理解Docker镜像构建和PHP扩展安装具有参考价值。





