mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 08:45:40 +08:00
deploy: afd6791075
This commit is contained in:
@@ -39,7 +39,7 @@ import{_ as s,c as e,o as a,af as n}from"./chunks/framework.PeLcR_tw.js";const k
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">extensions</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">bcmath,posix,phar,zlib,openssl,curl,fileinfo,tokenizer</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">sapi</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">cli</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">fpm</span></span></code></pre></div><p>Then use the <code>bin/spc craft</code> command to compile:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> craft</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --debug</span></span></code></pre></div><p>If the build is successful, you will see the <code>buildroot/bin</code> directory in the current directory, which contains the compiled PHP binary file, or the corresponding SAPI.</p><ul><li>cli: The build result is <code>buildroot/bin/php.exe</code> on Windows and <code>buildroot/bin/php</code> on other platforms.</li><li>fpm: The build result is <code>buildroot/bin/php-fpm</code>.</li><li>micro: The build result is <code>buildroot/bin/micro.sfx</code>. If you need to further package it with PHP code, please refer to <a href="./manual-build.html#command-micro-combine">Packaging micro binary</a>.</li><li>embed: See <a href="./manual-build.html#embed-usage">Using embed</a>.</li><li>frankenphp: The build result is <code>buildroot/bin/frankenphp</code>.</li></ul><p>If the build fails, you can use the <code>--debug</code> parameter to view detailed error information, or use the <code>--with-clean</code> to clear the old compilation results and recompile.</p><p>If the build still fails to use the above method, please submit an issue and attach your <code>craft.yml</code> and <code>craft.log</code>.</p><h2 id="step-by-step-build-command" tabindex="-1">Step-by-step build command <a class="header-anchor" href="#step-by-step-build-command" aria-label="Permalink to “Step-by-step build command”"></a></h2><p>If you have customized requirements, or the need to download and compile PHP and dependent libraries separately, you can use the <code>bin/spc</code> command to execute step by step.</p><h3 id="command-download-download-dependency-packages" tabindex="-1">Command download - Download dependency packages <a class="header-anchor" href="#command-download-download-dependency-packages" aria-label="Permalink to “Command download - Download dependency packages”"></a></h3><p>Use the command <code>bin/spc download</code> to download the source code required for compilation, including php-src and the source code of various dependent libraries.</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Download all dependencies, defaults to php 8.4</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">fpm</span></span></code></pre></div><p>Then use the <code>bin/spc craft</code> command to compile:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> craft</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --debug</span></span></code></pre></div><p>If the build is successful, you will see the <code>buildroot/bin</code> directory in the current directory, which contains the compiled PHP binary file, or the corresponding SAPI.</p><ul><li>cli: The build result is <code>buildroot/bin/php.exe</code> on Windows and <code>buildroot/bin/php</code> on other platforms.</li><li>fpm: The build result is <code>buildroot/bin/php-fpm</code>.</li><li>micro: The build result is <code>buildroot/bin/micro.sfx</code>. If you need to further package it with PHP code, please refer to <a href="./manual-build.html#command-micro-combine">Packaging micro binary</a>.</li><li>embed: See <a href="./manual-build.html#embed-usage">Using embed</a>.</li><li>frankenphp: The build result is <code>buildroot/bin/frankenphp</code>.</li></ul><p>If the build fails, you can use the <code>--debug</code> parameter to view detailed error information, or use the <code>--with-clean</code> to clear the old compilation results and recompile.</p><p>If the build still fails to use the above method, please submit an issue and attach your <code>craft.yml</code> and <code>./log</code> archive.</p><h2 id="step-by-step-build-command" tabindex="-1">Step-by-step build command <a class="header-anchor" href="#step-by-step-build-command" aria-label="Permalink to “Step-by-step build command”"></a></h2><p>If you have customized requirements, or the need to download and compile PHP and dependent libraries separately, you can use the <code>bin/spc</code> command to execute step by step.</p><h3 id="command-download-download-dependency-packages" tabindex="-1">Command download - Download dependency packages <a class="header-anchor" href="#command-download-download-dependency-packages" aria-label="Permalink to “Command download - Download dependency packages”"></a></h3><p>Use the command <code>bin/spc download</code> to download the source code required for compilation, including php-src and the source code of various dependent libraries.</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Download all dependencies, defaults to php 8.4</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --all</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Download all dependent packages, and specify the main version of PHP to download, optional: 8.1, 8.2, 8.3, 8.4</span></span>
|
||||
@@ -35,7 +35,7 @@ import{_ as i,c as a,o as n,af as l}from"./chunks/framework.PeLcR_tw.js";const o
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">extensions</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">bcmath,posix,phar,zlib,openssl,curl,fileinfo,tokenizer</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">sapi</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">cli</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">fpm</span></span></code></pre></div><p>然后使用 <code>bin/spc craft</code> 命令来编译:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> craft</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --debug</span></span></code></pre></div><p>如果构建成功,你会在当前目录下看到 <code>buildroot/bin</code> 目录,里面包含了编译好的 PHP 二进制文件,或相应的 SAPI。</p><ul><li>cli: Windows 下构建结果为 <code>buildroot/bin/php.exe</code>,其他平台为 <code>buildroot/bin/php</code>。</li><li>fpm: 构建结果为 <code>buildroot/bin/php-fpm</code>。</li><li>micro: 构建结果为 <code>buildroot/bin/micro.sfx</code>,如需进一步与 PHP 代码打包,请查看 <a href="./manual-build.html#命令-micro-combine-打包-micro-二进制">打包 micro 二进制</a>。</li><li>embed: 参见 <a href="./manual-build.html#embed-使用">embed 使用</a>。</li><li>frankenphp: 构建结果为 <code>buildroot/bin/frankenphp</code>。</li></ul><p>如果中途构建出错,你可以使用 <code>--debug</code> 参数查看详细的错误信息,或者使用 <code>--with-clean</code> 参数清除旧的编译结果,重新编译。</p><p>如使用以上方式仍构建失败,请提交一个 issue,附上你的 <code>craft.yml</code>、<code>craft.log</code>。</p><h2 id="分步构建命令" tabindex="-1">分步构建命令 <a class="header-anchor" href="#分步构建命令" aria-label="Permalink to “分步构建命令”"></a></h2><p>如果你有定制化需求,或分开下载、编译 PHP 和依赖库的需求,可以使用 <code>bin/spc</code> 命令分步执行。</p><h3 id="命令-download-下载依赖包" tabindex="-1">命令 download - 下载依赖包 <a class="header-anchor" href="#命令-download-下载依赖包" aria-label="Permalink to “命令 download - 下载依赖包”"></a></h3><p>使用命令 <code>bin/spc download</code> 可以下载编译需要的源代码,包括 php-src 以及依赖的各种库的源码。</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 仅下载要编译的扩展及依赖库(使用扩展名,包含可选库)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">fpm</span></span></code></pre></div><p>然后使用 <code>bin/spc craft</code> 命令来编译:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> craft</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --debug</span></span></code></pre></div><p>如果构建成功,你会在当前目录下看到 <code>buildroot/bin</code> 目录,里面包含了编译好的 PHP 二进制文件,或相应的 SAPI。</p><ul><li>cli: Windows 下构建结果为 <code>buildroot/bin/php.exe</code>,其他平台为 <code>buildroot/bin/php</code>。</li><li>fpm: 构建结果为 <code>buildroot/bin/php-fpm</code>。</li><li>micro: 构建结果为 <code>buildroot/bin/micro.sfx</code>,如需进一步与 PHP 代码打包,请查看 <a href="./manual-build.html#命令-micro-combine-打包-micro-二进制">打包 micro 二进制</a>。</li><li>embed: 参见 <a href="./manual-build.html#embed-使用">embed 使用</a>。</li><li>frankenphp: 构建结果为 <code>buildroot/bin/frankenphp</code>。</li></ul><p>如果中途构建出错,你可以使用 <code>--debug</code> 参数查看详细的错误信息,或者使用 <code>--with-clean</code> 参数清除旧的编译结果,重新编译。</p><p>如使用以上方式仍构建失败,请提交一个 issue,附上你的 <code>craft.yml</code> 文件、<code>log/</code> 目录的压缩包。</p><h2 id="分步构建命令" tabindex="-1">分步构建命令 <a class="header-anchor" href="#分步构建命令" aria-label="Permalink to “分步构建命令”"></a></h2><p>如果你有定制化需求,或分开下载、编译 PHP 和依赖库的需求,可以使用 <code>bin/spc</code> 命令分步执行。</p><h3 id="命令-download-下载依赖包" tabindex="-1">命令 download - 下载依赖包 <a class="header-anchor" href="#命令-download-下载依赖包" aria-label="Permalink to “命令 download - 下载依赖包”"></a></h3><p>使用命令 <code>bin/spc download</code> 可以下载编译需要的源代码,包括 php-src 以及依赖的各种库的源码。</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 仅下载要编译的扩展及依赖库(使用扩展名,包含可选库)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --for-extensions=openssl,swoole,zip,pcntl,zstd</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 仅下载要编译的扩展及依赖库(使用扩展名,不包含可选库)</span></span>
|
||||
Reference in New Issue
Block a user