自行编译一般问题多多 低版本一般定制插件要自行编译
php7.33 +memcached 成品
https://github.com/jingjingxyk/swoole-cli/actions/runs/10861004482
尽量使用已经编译好的成品 https://github.com/jingjingxyk/swoole-cli/tags
最新版本8+ https://www.swoole.com/download
如有问题可以咨询工具作者 https://github.com/jingjingxyk/swoole-cli/issues
#我是乌班图系统linux Ubuntu 20 如果没有环境可以去阿里云买个抢占式编译
#apt 跟yum类似
#安装容器依赖库
sudo apt update
sudo apt upgrade
apt install apt-transport-https ca-certificates curl software-properties-common git
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce
#安装docker完毕
#拉取指定分支代码
git clone -b build_php_7.3 https://github.com/jingjingxyk/swoole-cli.git
#进入目录
cd swoole-cli
# 启用 alpine:3.17 容器环境 (docker pull alpine:3.17)
# bash sapi/quickstart/linux/run-alpine-container.sh #如果失败了用这个
bash sapi/quickstart/linux/run-alpine-container-full.sh
# 进入容器
bash sapi/quickstart/linux/connection-swoole-cli-alpine.sh
# 准备基础运行环境
sh sapi/quickstart/linux/alpine-init.sh --mirror china
# 准备PHP 运行时 (看提示,把 PHP-cli 运行时导入环境变量PATH )
sh setup-php-runtime.sh --mirror china
#编译
php prepare.php +memcached -redis
--with-swoole-pgsql=1 --with-libavif=1
--with-php-version=7.3.33
--with-build-type=release
--with-c-compiler=clang
--with-install-library-cached=1
# 静态编译 编译依赖库(生成静态依赖库)
bash make.sh all-library
# 静态编译 PHP 预处理
bash make.sh config
# 静态编译PHP (编译、汇编、链接)
bash make.sh build
# 静态编译PHP (打包)
bash make.sh archive
# 编译结果下载 https://github.com/jingjingxyk/swoole-cli/actions/runs/10861004482
# php 8.2.7
--with-php-version=8.2.7
# php 8.1.21
--with-php-version=8.1.21
# php 7.4.33
--with-php-version=7.4.33
# 构建php7.4 7.3 版本需要特别处理之处(更换分支即可)
# php 7.4 、7.3 分支需要单独克隆
#( 区别: openss 使用 v1 版本, curl 库 不启用http2库 http3库 ,GD 库因libXpm编译失败,默认未启用)
#除了更换分支,构建步骤仍然如上
# php 7.4
git clone -b build_php_7.4 https://github.com/jingjingxyk/swoole-cli/
# php 7.3
git clone -b build_php_7.3 https://github.com/jingjingxyk/swoole-cli/
Swoole 最新版扩展 ZTS 专用
git clone https://github.com/swoole/swoole-src.git
cd swoole-src
phpize
./configure --enable-swoole-thread
make -j $(nproc)
make install