mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
update README
This commit is contained in:
parent
528ad1199a
commit
48f40b4304
38
README-en.md
38
README-en.md
@ -37,7 +37,7 @@ Please first select the extension you want to compile based on the extension lis
|
|||||||
|
|
||||||
### Supported Extensions
|
### Supported Extensions
|
||||||
|
|
||||||
[Support Extension List](/ext-support.md)
|
[Supported Extension List](/ext-support.md)
|
||||||
|
|
||||||
### GitHub Actions Build
|
### GitHub Actions Build
|
||||||
|
|
||||||
@ -56,14 +56,36 @@ If you enable `debug`, all logs will be output at build time, including compiled
|
|||||||
|
|
||||||
### Manual Build
|
### Manual Build
|
||||||
|
|
||||||
|
Clone repo first:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone first
|
|
||||||
git clone https://github.com/crazywhalecc/static-php-cli.git
|
git clone https://github.com/crazywhalecc/static-php-cli.git
|
||||||
|
```
|
||||||
|
|
||||||
|
If you have not installed php on your system, you can download single-file php binary and composer first.
|
||||||
|
|
||||||
|
The PHP runtime for static-php-cli itself will be downloaded at `bin/php`, and composer is at `bin/composer`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd static-php-cli
|
||||||
|
chmod +x bin/setup-runtime
|
||||||
|
./bin/setup-runtime
|
||||||
|
|
||||||
|
# Use this php runtime to run static-php-cli compiler
|
||||||
|
./bin/php bin/spc
|
||||||
|
|
||||||
|
# Use composer
|
||||||
|
./bin/php bin/composer
|
||||||
|
```
|
||||||
|
|
||||||
|
Basic usage for building php and micro with some extensions:
|
||||||
|
|
||||||
|
```bash
|
||||||
cd static-php-cli
|
cd static-php-cli
|
||||||
composer update
|
composer update
|
||||||
chmod +x bin/spc
|
chmod +x bin/spc
|
||||||
# Check system tool dependencies, and show instructions for fixing (TODO)
|
# Check system tool dependencies, fix them automatically (only support macOS) (TODO: Linux distro support)
|
||||||
# ./spc doctor
|
./bin/spc doctor
|
||||||
# fetch all libraries
|
# fetch all libraries
|
||||||
./bin/spc fetch --all
|
./bin/spc fetch --all
|
||||||
# with bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl extension, build both CLI and phpmicro SAPI
|
# with bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl extension, build both CLI and phpmicro SAPI
|
||||||
@ -73,13 +95,14 @@ chmod +x bin/spc
|
|||||||
You can also use the parameter `--with-php=x.y` to specify the downloaded PHP version, currently supports 7.4 ~ 8.2:
|
You can also use the parameter `--with-php=x.y` to specify the downloaded PHP version, currently supports 7.4 ~ 8.2:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Using PHP >= 8.0 is recommended, because 7.4 cannot use phpmicro
|
||||||
./bin/spc fetch --with-php=8.2 --all
|
./bin/spc fetch --with-php=8.2 --all
|
||||||
```
|
```
|
||||||
|
|
||||||
If anything goes wrong, use `--debug` option to display full terminal output:
|
If anything goes wrong, use `--debug` option to display full terminal output:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/spc build openssl --debug
|
./bin/spc build openssl,pcntl,mbstring --debug
|
||||||
./bin/spc fetch --all --debug
|
./bin/spc fetch --all --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -100,8 +123,9 @@ This file will be located in the directory `source/php-src/sapi/cli/`, simply co
|
|||||||
|
|
||||||
### micro.sfx Usage
|
### micro.sfx Usage
|
||||||
|
|
||||||
> phpmicro is a Self-Extracted Executable SAPI module, provided by [dixyes/phpmicro](https://github.com/dixyes/phpmicro).
|
> phpmicro is a Self-Extracted Executable SAPI module,
|
||||||
> This project is integrated with it.
|
> provided by [dixyes/phpmicro](https://github.com/dixyes/phpmicro).
|
||||||
|
> It can put php runtime and your source code together.
|
||||||
|
|
||||||
When using the parameter `--build-all` or `--build-micro`,
|
When using the parameter `--build-all` or `--build-micro`,
|
||||||
the final compilation result will output a file named `./micro.sfx`,
|
the final compilation result will output a file named `./micro.sfx`,
|
||||||
|
|||||||
32
README.md
32
README.md
@ -52,14 +52,37 @@ If you are using English, see [English README](README-en.md).
|
|||||||
|
|
||||||
### 手动构建
|
### 手动构建
|
||||||
|
|
||||||
|
先克隆本项目:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/crazywhalecc/static-php-cli.git
|
||||||
|
```
|
||||||
|
|
||||||
|
如果你本机没有安装 PHP,你可以通过命令下载静态编译好的 php-cli 和 Composer。
|
||||||
|
|
||||||
|
下载的 php 和 Composer 将保存为 `bin/php` 和 `bin/composer`。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd static-php-cli
|
||||||
|
chmod +x bin/setup-runtime
|
||||||
|
./bin/setup-runtime
|
||||||
|
|
||||||
|
# 使用独立的 php 运行 static-php-cli
|
||||||
|
./bin/php bin/spc
|
||||||
|
|
||||||
|
# 使用 composer
|
||||||
|
./bin/php bin/composer
|
||||||
|
```
|
||||||
|
|
||||||
|
下面是使用 static-php-cli 编译静态 php 和 micro 的基础用法:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 克隆本项目
|
# 克隆本项目
|
||||||
git clone https://github.com/crazywhalecc/static-php-cli.git
|
|
||||||
cd static-php-cli
|
cd static-php-cli
|
||||||
composer update
|
composer update
|
||||||
chmod +x bin/spc
|
chmod +x bin/spc
|
||||||
# 检查环境依赖,并根据提示的命令安装缺失的编译工具(TODO)
|
# 检查环境依赖,并根据提示的命令安装缺失的编译工具(目前仅支持 macOS,Linux 后续会支持)
|
||||||
# ./bin/spc doctor
|
./bin/spc doctor
|
||||||
# 拉取所有依赖库
|
# 拉取所有依赖库
|
||||||
./bin/spc fetch --all
|
./bin/spc fetch --all
|
||||||
# 构建包含 bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl 扩展的 php-cli 和 micro.sfx
|
# 构建包含 bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl 扩展的 php-cli 和 micro.sfx
|
||||||
@ -69,13 +92,14 @@ chmod +x bin/spc
|
|||||||
你也可以使用参数 `--with-php=x.y` 来指定下载的 PHP 版本,目前支持 7.4 ~ 8.2:
|
你也可以使用参数 `--with-php=x.y` 来指定下载的 PHP 版本,目前支持 7.4 ~ 8.2:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# 优先考虑使用 >= 8.0 的 PHP 版本
|
||||||
./bin/spc fetch --with-php=8.2 --all
|
./bin/spc fetch --with-php=8.2 --all
|
||||||
```
|
```
|
||||||
|
|
||||||
如果出现了任何错误,可以使用 `--debug` 参数来展示完整的输出日志,以供排查错误:
|
如果出现了任何错误,可以使用 `--debug` 参数来展示完整的输出日志,以供排查错误:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./bin/spc build openssl --debug
|
./bin/spc build openssl,pcntl,mbstring --debug
|
||||||
./bin/spc fetch --all --debug
|
./bin/spc fetch --all --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user