mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-03 06:45:39 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d89397cca | ||
|
|
028063174c | ||
|
|
fbfed34dc9 | ||
|
|
ca226fe4d9 | ||
|
|
1902057be1 |
@@ -2,10 +2,10 @@
|
||||
Compile A Statically Linked PHP With Swoole and other Extensions
|
||||
编译纯静态的 PHP Binary 二进制文件,带有各种扩展(CLI 模式,暂不支持 CGI 和 FPM 模式)
|
||||
|
||||
[]()
|
||||
[]()
|
||||
|
||||
## 环境需求
|
||||
- 目前在 x86_64 平台试验成功,其他架构需自行测试
|
||||
- 目前在 x86_64 和 aarch64(arm64) 架构上编译成功,其他架构需自行测试
|
||||
- 需要 Alpine Linux(测试环境为 3.13 版本,其他版本未测试)系统(也就是说需要 musl)
|
||||
- WSL2 也是支持的
|
||||
|
||||
@@ -46,7 +46,7 @@ Compile A Statically Linked PHP With Swoole and other Extensions
|
||||
|
||||
## 运行示例
|
||||
编译后的状态
|
||||

|
||||

|
||||
|
||||
在不同系统直接运行 Swoft
|
||||

|
||||
|
||||
@@ -13,7 +13,7 @@ do
|
||||
"$_main_dir""static-compile-php.sh" && \
|
||||
cp "$_main_dir""php-dist/bin/php" "$_build_dir/" && \
|
||||
cd "$_build_dir/" && \
|
||||
tar -zcvf "php-$loop-static-bin.tar.gz" "./php" && \
|
||||
tar -zcvf "php-$loop-static-bin-"$(uname -m)".tar.gz" "./php" && \
|
||||
mv "./php" "./php-$loop" && \
|
||||
cd "$_main_dir"
|
||||
if [ $? -ne 0 ]; then
|
||||
|
||||
@@ -23,7 +23,7 @@ function downloadIt() {
|
||||
return 0
|
||||
}
|
||||
|
||||
_script_ver="1.1.0"
|
||||
_script_ver="1.1.1"
|
||||
|
||||
_php_ver="7.4.16"
|
||||
_swoole_ver="4.6.6"
|
||||
@@ -167,6 +167,7 @@ function compilePHPWithSwoole() {
|
||||
cat "$_home_dir""ac_override_1" "$_home_dir""source/php-""$_php_ver/ext/curl/config.m4" "$_home_dir""ac_override_2" > /tmp/aa && \
|
||||
mv /tmp/aa "$_home_dir""source/php-""$_php_ver/ext/curl/config.m4" && \
|
||||
./buildconf --force && \
|
||||
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:""$_home_dir""opt/libxml2/lib/pkgconfig" && \
|
||||
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:""$_home_dir""opt/curl/lib/pkgconfig" ./configure LDFLAGS=-static \
|
||||
--prefix="$_home_dir""php-dist" \
|
||||
--disable-all \
|
||||
@@ -231,6 +232,9 @@ apk add oniguruma-dev
|
||||
apk add openssl-libs-static openssl-dev openssl
|
||||
# php的gd支持,如果不需要gd则去掉--enable-gd和下面的依赖
|
||||
apk add libpng-dev libpng-static
|
||||
# curl的c-ares支持,如果不需要curl则去掉
|
||||
apk add c-ares-static c-ares-dev
|
||||
|
||||
|
||||
downloadAll && \
|
||||
compileLiblzma && \
|
||||
|
||||
Reference in New Issue
Block a user