-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swoole-cli 各分支功能区别 #273
Comments
experiment 分支新增:
build_native_php分支新增:
|
PHP 静态编译 完整的流程
准备构建环境,alpine:3.17
docker run --rm -ti --init -w /work alpine:3.17
apk update
apk add vim alpine-sdk xz autoconf automake linux-headers clang-dev clang lld libtool cmake bison re2c gettext coreutils gcc g++
apk add bash p7zip zip unzip flex pkgconf ca-certificates
apk add wget git curl
apk add libc++-static libltdl-static
apk add vim 准备构建脚本
#!/bin/env bash
set -uex
PHP_VERSION=8.1.21
test -f php-${PHP_VERSION}.tar.gz || wget -O php-${PHP_VERSION}.tar.gz https://github.com/php/php-src/archive/refs/tags/php-${PHP_VERSION}.tar.gz
test -d php-src && rm -rf php-src
mkdir -p php-src
tar --strip-components=1 -C php-src -xf php-${PHP_VERSION}.tar.gz
test -f redis-5.3.7.tgz || wget -O redis-5.3.7.tgz https://pecl.php.net/get/redis-5.3.7.tgz
mkdir -p redis
tar --strip-components=1 -C redis -xf redis-5.3.7.tgz
test -d php-src/ext/redis && rm -rf php-src/ext/redis
mv mongodb php-src/ext/
export CC=clang
export CXX=clang++
export LD=ld.lld
cd php-src
./buildconf --force
./configure \
--disable-all \
--disable-cgi \
--enable-shared=no \
--enable-static=yes \
--enable-cli \
--disable-phpdbg \
--without-valgrind \
--enable-session \
--enable-redis
make -j $(nproc)
file sapi/cli/php
readelf -h sapi/cli/php
执行构建即可bash build-static-php.sh
# 构建完毕 ,生成的如下文件,就是希望得到的二进制文件
sapi/cli/php
sapi/cli/php -m
sapi/cli/php -v
sapi/cli/php --ri redis
|
swoole-cli 就是在上述基础之上,做了进行裁剪 、优化、整合 、打包 等,并默认启用了swoole 扩展。 |
一句命令即可 为 linux 、macOS 准备 PHP 运行环境 (依赖 curl 、wget 、bash 、xz) curl https://github.com/swoole/swoole-cli/blob/main/setup-php-runtime.sh?raw=true -sSfL | bash -s -- --mirror china
curl https://swoole-cli.jingjingxyk.com/setup-php-runtime.sh -sSf | bash -s -- --mirror china
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
swoole-cli 各分支功能区别
swoole版本固定为v4.8.x,
openssl版本为 V1,
curl库不启用 http2、http3支持
build-static-php
用于构建原生的PHP版本,
可构建生成包含swow扩展的二进制文件 ,PHP源码未裁剪
不包含swoole扩展 ,
启用PHP FastCGI
用于构建原生的PHP-FPM
只构建 phpmicro 版本
swoole版本固定为v4.8.x,
openssl版本为 V1,
curl库不启用 http2、http3支持
不包含swoole 扩展
openssl版本为 V1,
curl库不启用 http2、http3支持
启用PHP FastCGI,
用于构建原生的PHP-FPM
gd、zip、imagick扩展 未能启用 ,
swoole版本固定为v4.8.x,
openssl版本为 V1,
curl库不启用 http2、http3支持 ,
The text was updated successfully, but these errors were encountered: