Files
static-php-cli/assets/zh_guide_sapi-reference.md.DXv5eV6I.js

55 lines
31 KiB
JavaScript
Raw Normal View History

import{_ as s,c as a,o as e,aj as l}from"./chunks/framework.C2AwuPrQ.js";const o=JSON.parse('{"title":"PHP SAPI 构建参考","description":"","frontmatter":{"outline":"deep"},"headers":[],"relativePath":"zh/guide/sapi-reference.md","filePath":"zh/guide/sapi-reference.md"}'),n={name:"zh/guide/sapi-reference.md"};function h(p,i,t,d,k,r){return e(),a("div",null,[...i[0]||(i[0]=[l(`<h1 id="php-sapi-构建参考" tabindex="-1">PHP SAPI 构建参考 <a class="header-anchor" href="#php-sapi-构建参考" aria-label="Permalink to “PHP SAPI 构建参考”"></a></h1><div class="tip custom-block"><p class="custom-block-title custom-block-title-default">TIP</p><p>如果你采用的是 spc 二进制方式安装,请将本章节中的所有 <code>spc</code> 替换为 <code>./spc</code> 或 <code>.\\spc.exe</code>。</p><p>如果你采用的是源码安装,请将 <code>spc</code> 替换为 <code>bin/spc</code>。</p></div><p>本页详细介绍 StaticPHP 支持的各类 PHP SAPI 的构建参数和使用方式。</p><h2 id="概览" tabindex="-1">概览 <a class="header-anchor" href="#概览" aria-label="Permalink to “概览”"></a></h2><table tabindex="0"><thead><tr><th>SAPI</th><th>构建参数</th><th>产物路径Linux/macOS</th><th>产物路径Windows</th><th>平台支持</th></tr></thead><tbody><tr><td>cli</td><td><code>--build-cli</code></td><td><code>buildroot/bin/php</code></td><td><code>buildroot/bin/php.exe</code></td><td>Linux、macOS、Windows</td></tr><tr><td>fpm</td><td><code>--build-fpm</code></td><td><code>buildroot/bin/php-fpm</code></td><td>—</td><td>Linux、macOS</td></tr><tr><td>micro</td><td><code>--build-micro</code></td><td><code>buildroot/bin/micro.sfx</code></td><td><code>buildroot/bin/micro.sfx</code></td><td>Linux、macOS、Windows</td></tr><tr><td>embed</td><td><code>--build-embed</code></td><td><code>buildroot/lib/libphp.a</code></td><td><code>buildroot/lib/php8embed.lib</code></td><td>Linux、macOS、Windows</td></tr><tr><td>frankenphp</td><td><code>--build-frankenphp</code></td><td><code>buildroot/bin/frankenphp</code></td><td><code>buildroot/bin/frankenphp.exe</code></td><td>Linux、macOS、Windows</td></tr></tbody></table><h2 id="cli" tabindex="-1">cli <a class="header-anchor" href="#cli" aria-label="Permalink to “cli”"></a></h2><p><code>cli</code> 是标准的 PHP 命令行程序,适用于在终端执行 PHP 脚本、交互式 shell 等场景。</p><h3 id="构建" tabindex="-1">构建 <a class="header-anchor" href="#构建" aria-label="Permalink to “构建”"></a></h3><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;">spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build:php</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;bcmath,openssl,curl&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --build-cli</span></span></code></pre></div><p>Windows 下产物为 <code>buildroot/bin/php.exe</code>,其他平台为 <code>buildroot/bin/php</code>。</p><p>完整选项参见 <a href="./cli-reference.html#sapi-selection">build:php — SAPI 选择</a> 和 <a href="./cli-reference.html#common-build-options">build:php — 通用构建选项</a>。</p><h3 id="使用" tabindex="-1">使用 <a class="header-anchor" href="#使用" aria-label="Permalink to “使用”"></a></h3><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;">./buildroot/bin/php</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -v</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./buildroot/bin/php</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -m</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 执行脚本</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./buildroot/bin/php</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> your-script.php</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 交互模式</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./buildroot/bin/php</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -a</span></span></code></pre></div><h3 id="php-ini-" tabindex="-1">php.ini <a class="header-anchor" href="#php-ini-" aria-label="Permalink to php.ini "></a></h3><p> PHP cli <code>php.ini</code></p><ol><li> <code>-c /path/to/php.ini</code> </li><li><code>PHP_INI_PATH</code> </li><li> <code>--with-config-file-path</code> <code>/usr/local/etc/php</code></li></ol><p> <code>./buildroot/bin/php --ini</code> PHP 使 ini </p><h3 id="-ini" tabindex="-1"> INI <a class="header-anchor" href="#-ini" aria-label="Permalink to INI"></a></h3><p>使 <code>-I</code> INI <code>php.ini</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;">spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build:php</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;bcmath,pcntl&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --build-cli</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -I</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;memory_limit=4G&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -I</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;disable_functions=system,exec&quot;</span></span></code></pre></div><p> INI <code>cli</code><code>micro</code><code>embed</code> SAPI</p><h2 id="fpm" tabindex="-1">fpm <a class="header-anchor" href="#fpm" aria-label="Permalink to fpm"></a></h2><p><code>fpm</code>FastCGI Process Manager NginxApache Web 使 Web </p><div class="warning custom-block"><p class="custom-block-title custom-block-title-default">WARNING</p><p><code>fpm</code> Windows </p></div><h3 id="-1" tabindex="-1"> <a class="header-anchor" href="#-1" aria-label="Permalink to "></a></h3><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;">spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build:php</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;bcmath,openssl,curl,pdo_mysql&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --build-fpm</span></span></code></pre></div><p> <code>buildroot/bin/php-fpm</code></p><p> <a href="./cli-reference.html#sapi-selection">build:php SAPI </a> <a href="./cli-reference.html#common-build-options">build:php </a></p><h3 id="使-1" tabindex="-1">使 <a class="header-anchor" href="#使-1" aria-label="Permalink to 使"></a></h3><p> <code>buildroot/bin/php-fpm</code> <code>php-fpm</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:#e1
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./buildroot/bin/php-fpm</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -v</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 指定配置文件启动</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./buildroot/bin/php-fpm</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -c</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /path/to/php.ini</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -y</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /path/to/php-fpm.conf</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 测试配置文件</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./buildroot/bin/php-fpm</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -t</span></span></code></pre></div><h3 id="-nginx-使" tabindex="-1"> Nginx 使 <a class="header-anchor" href="#-nginx-使" aria-label="Permalink to Nginx 使"></a></h3><div class="language-nginx"><button title="Copy Code" class="copy"></button><span class="lang">nginx</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:#D73A49;--shiki-dark:#F97583;">server</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> listen </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">80</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> root </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">/var/www/html;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> index </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">index.php;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> location</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> ~</span><span style="--shiki-light:#032F62;--shiki-dark:#DBEDFF;"> \\.php$ </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> fastcgi_pass </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">127.0.0.1:9000;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> fastcgi_param </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">SCRIPT_FILENAME $document_root$fastcgi_script_name;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> include </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">fastcgi_params;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p><code>php-fpm.conf</code> </p><div class="language-ini"><button title="Copy Code" class="copy"></button><span class="lang">ini</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;">[global]</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">pid</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = /var/run/php-fpm.pid</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">error_log</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = /var/log/php-fpm.log</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">[www]</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">listen</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = 127.0.0.1:9000</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">pm</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = dynamic</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">pm.max_children</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = 5</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">pm.start_servers</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = 2</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">pm.min_spare_servers</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = 1</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">pm.max_spare_servers</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> = 3</span></span></code></pre></div><h2 id="micro" tabindex="-1">micro <a class="header-anchor" href="#micro" aria-label="Permalink to micro"></a></h2><p><code>micro</code> <a href="https://github.com/easysoft/phpmicro" target="_blank" rel="noreferrer">phpmicro</a> SAPI <code>spc micro:combine</code> <code>micro.sfx</code> PHP PHP</p><h3 id="-2" tabindex="-1"> <a class="header-anchor" href="#-2" aria-label="Permalink to "></a></h3><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;">spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build:php</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;bcmath,phar,openssl,curl&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --build-micro</span></span></code></pre></div><p> <code>buildroot/bin/micro.sfx</code></p><p> <a href="./cli-reference.html#sapi-selection">build:php SAPI </a><a href="./cli-reference.html#common-build-options">build:php </a> <a href="./cli-reference.html#micro-options">build:php micro </a></p><h3 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to "></a></h3><p>使 <code>micro:combine</code> PHP phar </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;"># PHP </span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">echo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;&lt;?php echo &#39;Hello, World!&#39; . PHP_EOL;&quot;</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &gt;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> hello.php</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> micro:combine</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> hello.php</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --output=hello</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./hello</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 打包 phar 文件</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> micro:combine</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> your-app.phar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --output=your-app</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./your-app</span></span></code></pre></div><h3 id="-ini-" tabindex="-1"> INI <a class="header-anchor" href="#-ini-" aria-label="Permalink to INI "></a></h3><p> ini </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;"># -I --with-ini-set </span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> micro:combine</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> your-app.phar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --output=your-app</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -I</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;memory_limit=512M&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -I</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;curl.cainfo=/etc/ssl/certs/ca-certificates.crt&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 通过 ini 文件注入-N --with-ini-file 的简写</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> micro:combine</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> your-app.phar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --output=your-app</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -N</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /path/to/custom.ini</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title custom-block-title-default">TIP</p><p><code>-I</code> INI <code>micro.sfx</code> <code>-I</code> INI </p></div><h3 id="-cli-sapi" tabindex="-1"> cli SAPI <a class="header-anchor" href="#-cli-sapi" aria-label="Permalink to cli SAPI"></a></h3><p> <code>PHP_SAPI</code> <code>cli</code> <code>micro</code> <code>PHP_SAPI</code> <code>micro</code> <code>cli</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;">spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build:php</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;bcmath,phar&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --build-micro</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --with-micro-fake-cli</span></span></code></pre></div><h3 id="-micro-sfx-" tabindex="-1"> micro.sfx <a class="header-anchor" href="#-micro-sfx-" aria-label="Permalink to micro.sfx "></a></h3><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;">spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> micro:combine</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> your-app.phar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --output=your-app</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --with-micro=/path/to/your/micro.sfx</span></span></code></pre></div><h3 id="-phar-" tabindex="-1"> phar <a class="header-anchor" href="#-phar-" aria-label="Permalink to phar "></a></h3><p> phar phar 使<a href="./../develop/structure.html"> - Phar </a></p><h2 id="embed" tabindex="-1">embed <a class="header-anchor" href="#embed" aria-label="Permalink to embed"></a></h2><p><code>embed</code> SAPI PHP Linux/macOS <code>libphp.a</code>Windows <code>php8embed.lib</code> C/C++ PHP </p><h3 id="-3" tabindex="-1"> <a class="header-anchor" href="#-3" aria-label="Permalink to "></a></h3><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><s
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./buildroot/bin/frankenphp</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> version</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># PHP 内置服务器模式运行用于开发调试</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./buildroot/bin/frankenphp</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php-server</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 运行 Worker 模式</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./buildroot/bin/frankenphp</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --config</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /path/to/Caddyfile</span></span></code></pre></div><p> <a href="https://frankenphp.dev/docs/" target="_blank" rel="noreferrer">FrankenPHP </a></p><h2 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to "></a></h2><p> PHP <code>dl()</code> </p><p><strong>macOS</strong> <code>dl()</code> <code>php.ini</code> <code>.so</code> </p><p><strong>Linux</strong> StaticPHP <code>native-native-musl</code> musl libc <code>dl()</code> FFI 使 <code>.so</code> </p><p> Linux <code>SPC_TARGET</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:#24292E;--shiki-dark:#E1E4E8;">SPC_TARGET</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">native-native-gnu.2.17</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build:php</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;bcmath,openssl&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --build-cli</span></span></code></pre></div><p> <code>config/env.ini</code> <code>SPC_TARGET=native-native-gnu.2.17</code></p><p>使 Zig glibc 2.17 GNU/Linux Docker <code>dl()</code>FFI <code>.so</code> Alpine Linux musl </p><p><strong>Windows</strong> Windows PHP <code>.dll</code> PHP DLL StaticPHP PHP DLL Windows </p>`,83)])])}const b=s(n,[["render",h]]);export{o as __pageData,b as default};