From 01c4538ce0043203bee854eb2f8f5c094f06bbfc Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 12 Sep 2023 22:44:19 +0800 Subject: [PATCH] update README for embed SAPI --- README-en.md | 14 ++++++++++++-- README.md | 13 ++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README-en.md b/README-en.md index 9a2f5579..afc35f94 100755 --- a/README-en.md +++ b/README-en.md @@ -2,7 +2,7 @@ Build single static PHP binary, with PHP project together, with popular extensions included. -The project name is static-php-cli, but it actually supports cli, fpm, micro and embed (on the way) SAPI 😎 +The project name is static-php-cli, but it actually supports cli, fpm, micro and embed SAPI 😎 Compile a purely static php-cli binary file with various extensions to make PHP applications more portable! (cli SAPI) @@ -126,6 +126,7 @@ Now we support `cli`, `micro`, `fpm`, you can use one or more of the following p - `--build-cli`: build static cli executable - `--build-micro`: build static phpmicro self-extracted executable - `--build-fpm`: build static fpm binary +- `--build-embed`: build embed (libphp) - `--build-all`: build all If anything goes wrong, use `--debug` option to display full terminal output: @@ -194,9 +195,18 @@ Because php-fpm must specify a configuration file before running, the php-fpm co Specifying `php-fpm.conf` can use the command parameter `-y`, for example: `./php-fpm -y php-fpm.conf`. +### Embed Usage + +When using the project parameters `--build-embed` or `--build-all`, +the final compilation result will output a `libphp.a`, `php-config` and a series of header files, +stored in `buildroot/`, You can introduce them in your other projects. + +If you know embed SAPI, you should know how to use it. +You may require the introduction of other libraries during compilation, +you can use `buildroot/bin/php-config` to obtain the compile-time configuration. + ## Contribution -Currently, there are only a few supported extensions. If the extension you need is missing, you can create an issue. If you are familiar with this project, you are also welcome to initiate a pull request. diff --git a/README.md b/README.md index 9ea2bb50..62c9bab4 100755 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Build single static PHP binary, with PHP project together, with popular extensio [![](https://img.shields.io/badge/Extension%20Counter-55+-yellow.svg?style=flat-square)]() [![](https://img.shields.io/github/search/crazywhalecc/static-php-cli/TODO?label=TODO%20Counter&style=flat-square)]() -> 项目名称是 static-php-cli,但其实支持 cli、fpm、micro 和 embed(正在路上)SAPI 😎 +> 项目名称是 static-php-cli,但其实支持 cli、fpm、micro 和 embed SAPI 😎 ## 编译环境需求 @@ -120,6 +120,7 @@ chmod +x bin/spc - `--build-cli`:构建 cli 二进制 - `--build-micro`:构建 phpmicro 自执行二进制 - `--build-fpm`:构建 fpm +- `--build-embed`:构建 embed(libphp) - `--build-all`:构建所有 如果出现了任何错误,可以使用 `--debug` 参数来展示完整的输出日志,以供排查错误: @@ -181,9 +182,15 @@ cat micro.sfx code.php > single-app && chmod +x single-app 指定 `php-fpm.conf` 可以使用命令参数 `-y`,例如:`./php-fpm -y php-fpm.conf`。 +### 使用 php-embed + +采用项目参数 `--build-embed` 或 `--build-all` 时,最后编译结果会输出一个 `libphp.a`、`php-config` 以及一系列头文件,存放在 `buildroot/`,你可以在你的其他代码中引入它们。 + +如果你知道 embed SAPI,你应该知道如何使用它。对于有可能编译用到引入其他库的问题,你可以使用 `buildroot/bin/php-config` 来获取编译时的配置。 + ## 贡献 -目前支持的扩展较少,如果缺少你需要的扩展,可发起 Issue。如果你对本项目较熟悉,也欢迎为本项目发起 Pull Request。 +如果缺少你需要的扩展,可发起 Issue。如果你对本项目较熟悉,也欢迎为本项目发起 Pull Request。 贡献基本原则如下: @@ -202,7 +209,7 @@ cat micro.sfx code.php > single-app && chmod +x single-app ## 开源协议 -本项目依据旧版本惯例采用 MIT License 开源,自身的部分代码引用或修改自以下项目: +本项目依据旧版本惯例采用 MIT License 开源,部分扩展的集成编译命令参考或修改自以下项目: - [dixyes/lwmbs](https://github.com/dixyes/lwmbs)(木兰宽松许可证) - [swoole/swoole-cli](https://github.com/swoole/swoole-cli)(Apache 2.0 LICENSE、SWOOLE-CLI LICENSE)