mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
deploy: b6243d84786376df4b7cafe90ab05e5c3b938e21
This commit is contained in:
parent
0a9f306287
commit
d73a1490fc
2
assets/chunks/CliGenerator.ByPVB1Zk.js
Normal file
2
assets/chunks/CliGenerator.ByPVB1Zk.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
assets/chunks/SearchTable.CyGlUrS0.js
Normal file
1
assets/chunks/SearchTable.CyGlUrS0.js
Normal file
File diff suppressed because one or more lines are too long
1
assets/deps-map-ext.md.CLNwni-7.js
Normal file
1
assets/deps-map-ext.md.CLNwni-7.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{C as e}from"./chunks/CliGenerator.u1TQZKA-.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.gjrnbxUT.js";const i=n('<h1 id="cli-build-command-generator" tabindex="-1">CLI Build Command Generator <a class="header-anchor" href="#cli-build-command-generator" aria-label="Permalink to "CLI Build Command Generator""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>The extensions selected below may contain extensions that are not supported by the selected operating system, which may cause compilation to fail. Please check <a href="./extensions.html">Supported Extensions</a> first.</p></div>',2),u=JSON.parse('{"title":"CLI Build Command Generator","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"en/guide/cli-generator.md","filePath":"en/guide/cli-generator.md"}'),s={name:"en/guide/cli-generator.md"},h=t({...s,setup(c){return(l,d)=>(r(),a("div",null,[i,o(e,{lang:"en"})]))}});export{u as __pageData,h as default};
|
||||
import{C as e}from"./chunks/CliGenerator.ByPVB1Zk.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.gjrnbxUT.js";const i=n('<h1 id="cli-build-command-generator" tabindex="-1">CLI Build Command Generator <a class="header-anchor" href="#cli-build-command-generator" aria-label="Permalink to "CLI Build Command Generator""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>The extensions selected below may contain extensions that are not supported by the selected operating system, which may cause compilation to fail. Please check <a href="./extensions.html">Supported Extensions</a> first.</p></div>',2),u=JSON.parse('{"title":"CLI Build Command Generator","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"en/guide/cli-generator.md","filePath":"en/guide/cli-generator.md"}'),s={name:"en/guide/cli-generator.md"},h=t({...s,setup(c){return(l,d)=>(r(),a("div",null,[i,o(e,{lang:"en"})]))}});export{u as __pageData,h as default};
|
||||
@ -1 +1 @@
|
||||
import{C as e}from"./chunks/CliGenerator.u1TQZKA-.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.gjrnbxUT.js";const i=n('<h1 id="cli-build-command-generator" tabindex="-1">CLI Build Command Generator <a class="header-anchor" href="#cli-build-command-generator" aria-label="Permalink to "CLI Build Command Generator""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>The extensions selected below may contain extensions that are not supported by the selected operating system, which may cause compilation to fail. Please check <a href="./extensions.html">Supported Extensions</a> first.</p></div>',2),u=JSON.parse('{"title":"CLI Build Command Generator","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"en/guide/cli-generator.md","filePath":"en/guide/cli-generator.md"}'),s={name:"en/guide/cli-generator.md"},h=t({...s,setup(c){return(l,d)=>(r(),a("div",null,[i,o(e,{lang:"en"})]))}});export{u as __pageData,h as default};
|
||||
import{C as e}from"./chunks/CliGenerator.ByPVB1Zk.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.gjrnbxUT.js";const i=n('<h1 id="cli-build-command-generator" tabindex="-1">CLI Build Command Generator <a class="header-anchor" href="#cli-build-command-generator" aria-label="Permalink to "CLI Build Command Generator""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>The extensions selected below may contain extensions that are not supported by the selected operating system, which may cause compilation to fail. Please check <a href="./extensions.html">Supported Extensions</a> first.</p></div>',2),u=JSON.parse('{"title":"CLI Build Command Generator","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"en/guide/cli-generator.md","filePath":"en/guide/cli-generator.md"}'),s={name:"en/guide/cli-generator.md"},h=t({...s,setup(c){return(l,d)=>(r(),a("div",null,[i,o(e,{lang:"en"})]))}});export{u as __pageData,h as default};
|
||||
File diff suppressed because one or more lines are too long
1
assets/en_guide_deps-map.md.CqlUBlcY.js
Normal file
1
assets/en_guide_deps-map.md.CqlUBlcY.js
Normal file
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{_ as t}from"./chunks/SearchTable.B5gzMFOw.js";import{c as o,I as i,a1 as e,o as s}from"./chunks/framework.gjrnbxUT.js";const a=e('<h1 id="extensions" tabindex="-1">Extensions <a class="header-anchor" href="#extensions" aria-label="Permalink to "Extensions""></a></h1><blockquote><ul><li><code>yes</code>: supported</li><li><em>blank</em>: not supported yet, or WIP</li><li><code>no</code> with issue link: confirmed to be unavailable due to issue</li><li><code>partial</code> with issue link: supported but not perfect due to issue</li></ul></blockquote>',2),n=e('<div class="tip custom-block"><p class="custom-block-title">TIP</p><p>If an extension you need is missing, you can create a <a href="https://github.com/crazywhalecc/static-php-cli/issues" target="_blank" rel="noreferrer">Feature Request</a>.</p><p>Some extensions or libraries that the extension depends on will have some optional features. For example, the gd library optionally supports libwebp, freetype, etc. If you only use <code>bin/spc build gd --build-cli</code> they will not be included (static-php-cli defaults to the minimum dependency principle).</p><p>For more information about optional libraries, see <a href="./deps-map.html">Extensions, Library Dependency Map</a>. For optional libraries, you can also select an extension from the <a href="./cli-generator.html">Command Generator</a> and then select optional libraries.</p></div>',1),_=JSON.parse('{"title":"Extensions","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/extensions.md","filePath":"en/guide/extensions.md"}'),l={name:"en/guide/extensions.md"},m=Object.assign(l,{setup(r){return(c,p)=>(s(),o("div",null,[a,i(t),n]))}});export{_ as __pageData,m as default};
|
||||
import{_ as t}from"./chunks/SearchTable.CyGlUrS0.js";import{c as o,I as i,a1 as e,o as s}from"./chunks/framework.gjrnbxUT.js";const a=e('<h1 id="extensions" tabindex="-1">Extensions <a class="header-anchor" href="#extensions" aria-label="Permalink to "Extensions""></a></h1><blockquote><ul><li><code>yes</code>: supported</li><li><em>blank</em>: not supported yet, or WIP</li><li><code>no</code> with issue link: confirmed to be unavailable due to issue</li><li><code>partial</code> with issue link: supported but not perfect due to issue</li></ul></blockquote>',2),n=e('<div class="tip custom-block"><p class="custom-block-title">TIP</p><p>If an extension you need is missing, you can create a <a href="https://github.com/crazywhalecc/static-php-cli/issues" target="_blank" rel="noreferrer">Feature Request</a>.</p><p>Some extensions or libraries that the extension depends on will have some optional features. For example, the gd library optionally supports libwebp, freetype, etc. If you only use <code>bin/spc build gd --build-cli</code> they will not be included (static-php-cli defaults to the minimum dependency principle).</p><p>For more information about optional libraries, see <a href="./deps-map.html">Extensions, Library Dependency Map</a>. For optional libraries, you can also select an extension from the <a href="./cli-generator.html">Command Generator</a> and then select optional libraries.</p></div>',1),_=JSON.parse('{"title":"Extensions","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/extensions.md","filePath":"en/guide/extensions.md"}'),l={name:"en/guide/extensions.md"},m=Object.assign(l,{setup(r){return(c,p)=>(s(),o("div",null,[a,i(t),n]))}});export{_ as __pageData,m as default};
|
||||
@ -1 +1 @@
|
||||
import{_ as t}from"./chunks/SearchTable.B5gzMFOw.js";import{c as o,I as i,a1 as e,o as s}from"./chunks/framework.gjrnbxUT.js";const a=e("",2),n=e("",1),_=JSON.parse('{"title":"Extensions","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/extensions.md","filePath":"en/guide/extensions.md"}'),l={name:"en/guide/extensions.md"},m=Object.assign(l,{setup(r){return(c,p)=>(s(),o("div",null,[a,i(t),n]))}});export{_ as __pageData,m as default};
|
||||
import{_ as t}from"./chunks/SearchTable.CyGlUrS0.js";import{c as o,I as i,a1 as e,o as s}from"./chunks/framework.gjrnbxUT.js";const a=e("",2),n=e("",1),_=JSON.parse('{"title":"Extensions","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/extensions.md","filePath":"en/guide/extensions.md"}'),l={name:"en/guide/extensions.md"},m=Object.assign(l,{setup(r){return(c,p)=>(s(),o("div",null,[a,i(t),n]))}});export{_ as __pageData,m as default};
|
||||
@ -21,7 +21,11 @@ import{_ as s,c as i,o as a,a1 as e}from"./chunks/framework.gjrnbxUT.js";const u
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> static-php-cli</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># You need to install the PHP environment first before running Composer and this project. The installation method can be referred to below.</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">composer</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> update</span></span></code></pre></div><h3 id="use-system-php" tabindex="-1">Use System PHP <a class="header-anchor" href="#use-system-php" aria-label="Permalink to "Use System PHP""></a></h3><p>Below are some example commands for installing PHP and Composer in the system. It is recommended to search for the specific installation method yourself or ask the AI search engine to obtain the answer, which will not be elaborated here.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># [macOS], need install Homebrew first. See https://brew.sh/</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">composer</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> update</span></span></code></pre></div><h3 id="use-precompiled-static-php-binaries" tabindex="-1">Use Precompiled Static PHP Binaries <a class="header-anchor" href="#use-precompiled-static-php-binaries" aria-label="Permalink to "Use Precompiled Static PHP Binaries""></a></h3><p>If you don't want to use Docker and install PHP in the system, you can directly download the php binary cli program compiled by this project itself. The usage process is as follows:</p><p>Deploy the environment using the command, the command will download a static php-cli binary from <a href="https://dl.static-php.dev/static-php-cli/" target="_blank" rel="noreferrer">self-hosted server</a>. Next, it will automatically download Composer from <a href="https://getcomposer.org/download/latest-stable/composer.phar" target="_blank" rel="noreferrer">getcomposer</a> or <a href="https://mirrors.aliyun.com/composer/composer.phar" target="_blank" rel="noreferrer">Aliyun mirror</a>.</p><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>Using precompiled static PHP binaries is currently only supported on Linux and macOS. The FreeBSD environment is currently not supported due to the lack of an automated build environment.</p></div><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/setup-runtime</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># For users with special network environments such as mainland China, you can use mirror sites (aliyun) to speed up the download speed</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/setup-runtime</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --mirror</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> china</span></span></code></pre></div><p>This script will download two files in total: <code>bin/php</code> and <code>bin/composer</code>. After the download is complete, there are two ways to use it:</p><ol><li>Add the <code>bin/</code> directory to the PATH: <code>export PATH="/path/to/your/static-php-cli/bin:$PATH"</code>, after adding the path, it is equivalent to installing PHP in the system, you can directly Use commands such as <code>composer</code>, <code>php -v</code>, or directly use <code>bin/spc</code>.</li><li>Direct call, such as executing static-php-cli command: <code>bin/php bin/spc --help</code>, executing Composer: <code>bin/php bin/composer update</code>.</li></ol><h3 id="use-docker" tabindex="-1">Use Docker <a class="header-anchor" href="#use-docker" aria-label="Permalink to "Use Docker""></a></h3><p>If you don't want to install PHP and Composer runtime environment on your system, you can use the built-in Docker environment build script.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># To use directly, replace \`bin/spc\` with \`bin/spc-alpine-docker\` in all used commands</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc-alpine-docker</span></span></code></pre></div><p>The first time the command is executed, <code>docker build</code> will be used to build a Docker image. The default built Docker image is the <code>x86_64</code> architecture, and the image name is <code>cwcc-spc-x86_64</code>.</p><p>If you want to build <code>aarch64</code> static-php-cli in <code>x86_64</code> environment, you can use qemu to emulate the arm image to run Docker, but the speed will be very slow. Use command: <code>SPC_USE_ARCH=aarch64 bin/spc-alpine-docker</code>.</p><p>If it prompts that sudo is required to run after running, execute the following command once to grant static-php-cli permission to execute sudo:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> SPC_USE_SUDO</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">yes</span></span></code></pre></div><h3 id="use-system-php" tabindex="-1">Use System PHP <a class="header-anchor" href="#use-system-php" aria-label="Permalink to "Use System PHP""></a></h3><p>Below are some example commands for installing PHP and Composer in the system. It is recommended to search for the specific installation method yourself or ask the AI search engine to obtain the answer, which will not be elaborated here.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># [macOS], need install Homebrew first. See https://brew.sh/</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Remember change your composer executable path. For M1/M2 Chip mac, "/opt/homebrew/bin/", for Intel mac, "/usr/local/bin/". Or add it to your own path.</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">brew</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> wget</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">wget</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://getcomposer.org/download/latest-stable/composer.phar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -O</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /path/to/your/bin/composer</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> && </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">chmod</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> +x</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /path/to/your/bin/composer</span></span>
|
||||
@ -30,11 +34,7 @@ import{_ as s,c as i,o as a,a1 as e}from"./chunks/framework.gjrnbxUT.js";const u
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> apt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php-cli</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> composer</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php-tokenizer</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># [Alpine]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">apk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> add</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> bash</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> file</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> wget</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> xz</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-common</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-pcntl</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-tokenizer</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-phar</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-posix</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-xml</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> composer</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>Currently, some versions of Ubuntu install older PHP versions, so no installation commands are provided. If necessary, it is recommended to add software sources such as ppa first, and then install the latest version of PHP and tokenizer, XML, and phar extensions.</p><p>Older versions of Debian may have an older (<= 7.4) version of PHP installed by default, it is recommended to upgrade Debian first.</p></div><h3 id="use-docker" tabindex="-1">Use Docker <a class="header-anchor" href="#use-docker" aria-label="Permalink to "Use Docker""></a></h3><p>If you don't want to install PHP and Composer runtime environment on your system, you can use the built-in Docker environment build script.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># To use directly, replace \`bin/spc\` with \`bin/spc-alpine-docker\` in all used commands</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc-alpine-docker</span></span></code></pre></div><p>The first time the command is executed, <code>docker build</code> will be used to build a Docker image. The default built Docker image is the <code>x86_64</code> architecture, and the image name is <code>cwcc-spc-x86_64</code>.</p><p>If you want to build <code>aarch64</code> static-php-cli in <code>x86_64</code> environment, you can use qemu to emulate the arm image to run Docker, but the speed will be very slow. Use command: <code>SPC_USE_ARCH=aarch64 bin/spc-alpine-docker</code>.</p><p>If it prompts that sudo is required to run after running, execute the following command once to grant static-php-cli permission to execute sudo:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> SPC_USE_SUDO</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">yes</span></span></code></pre></div><h3 id="use-precompiled-static-php-binaries" tabindex="-1">Use Precompiled Static PHP Binaries <a class="header-anchor" href="#use-precompiled-static-php-binaries" aria-label="Permalink to "Use Precompiled Static PHP Binaries""></a></h3><p>If you don't want to use Docker and install PHP in the system, you can directly download the php binary cli program compiled by this project itself. The usage process is as follows:</p><p>Deploy the environment using the command, the command will download a static php-cli binary from <a href="https://dl.static-php.dev/static-php-cli/" target="_blank" rel="noreferrer">self-hosted server</a>. Next, it will automatically download Composer from <a href="https://getcomposer.org/download/latest-stable/composer.phar" target="_blank" rel="noreferrer">getcomposer</a> or <a href="https://mirrors.aliyun.com/composer/composer.phar" target="_blank" rel="noreferrer">Aliyun mirror</a>.</p><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>Using precompiled static PHP binaries is currently only supported on Linux and macOS. The FreeBSD environment is currently not supported due to the lack of an automated build environment.</p></div><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/setup-runtime</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># For users with special network environments such as mainland China, you can use mirror sites (aliyun) to speed up the download speed</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/setup-runtime</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --mirror</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> china</span></span></code></pre></div><p>This script will download two files in total: <code>bin/php</code> and <code>bin/composer</code>. After the download is complete, there are two ways to use it:</p><ol><li>Add the <code>bin/</code> directory to the PATH: <code>export PATH="/path/to/your/static-php-cli/bin:$PATH"</code>, after adding the path, it is equivalent to installing PHP in the system, you can directly Use commands such as <code>composer</code>, <code>php -v</code>, or directly use <code>bin/spc</code>.</li><li>Direct call, such as executing static-php-cli command: <code>bin/php bin/spc --help</code>, executing Composer: <code>bin/php bin/composer update</code>.</li></ol><h2 id="command-download" tabindex="-1">Command - download <a class="header-anchor" href="#command-download" aria-label="Permalink to "Command - download""></a></h2><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 vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Download all dependencies</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">apk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> add</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> bash</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> file</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> wget</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> xz</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-common</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-pcntl</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-tokenizer</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-phar</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-posix</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-xml</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> composer</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>Currently, some versions of Ubuntu install older PHP versions, so no installation commands are provided. If necessary, it is recommended to add software sources such as ppa first, and then install the latest version of PHP and tokenizer, XML, and phar extensions.</p><p>Older versions of Debian may have an older (<= 7.4) version of PHP installed by default, it is recommended to upgrade Debian first.</p></div><h2 id="command-download" tabindex="-1">Command - download <a class="header-anchor" href="#command-download" aria-label="Permalink to "Command - download""></a></h2><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 vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Download all dependencies</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>
|
||||
1
assets/style.BHa18xBM.css
Normal file
1
assets/style.BHa18xBM.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{C as e}from"./chunks/CliGenerator.u1TQZKA-.js";import{d as a,c as t,I as o,a1 as r,o as i}from"./chunks/framework.gjrnbxUT.js";const s=r('<h1 id="cli-编译命令生成器" tabindex="-1">CLI 编译命令生成器 <a class="header-anchor" href="#cli-编译命令生成器" aria-label="Permalink to "CLI 编译命令生成器""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>下面选择扩展可能包含所选操作系统不支持的扩展,这可能导致编译失败。请先查阅 <a href="./extensions.html">支持的扩展</a>。</p></div>',2),p=JSON.parse('{"title":"CLI 编译命令生成器","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),c={name:"zh/guide/cli-generator.md"},_=a({...c,setup(l){return(n,d)=>(i(),t("div",null,[s,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
import{C as e}from"./chunks/CliGenerator.ByPVB1Zk.js";import{d as a,c as t,I as o,a1 as r,o as i}from"./chunks/framework.gjrnbxUT.js";const s=r('<h1 id="cli-编译命令生成器" tabindex="-1">CLI 编译命令生成器 <a class="header-anchor" href="#cli-编译命令生成器" aria-label="Permalink to "CLI 编译命令生成器""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>下面选择扩展可能包含所选操作系统不支持的扩展,这可能导致编译失败。请先查阅 <a href="./extensions.html">支持的扩展</a>。</p></div>',2),p=JSON.parse('{"title":"CLI 编译命令生成器","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),c={name:"zh/guide/cli-generator.md"},_=a({...c,setup(l){return(n,d)=>(i(),t("div",null,[s,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
@ -1 +1 @@
|
||||
import{C as e}from"./chunks/CliGenerator.u1TQZKA-.js";import{d as a,c as t,I as o,a1 as r,o as i}from"./chunks/framework.gjrnbxUT.js";const s=r('<h1 id="cli-编译命令生成器" tabindex="-1">CLI 编译命令生成器 <a class="header-anchor" href="#cli-编译命令生成器" aria-label="Permalink to "CLI 编译命令生成器""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>下面选择扩展可能包含所选操作系统不支持的扩展,这可能导致编译失败。请先查阅 <a href="./extensions.html">支持的扩展</a>。</p></div>',2),p=JSON.parse('{"title":"CLI 编译命令生成器","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),c={name:"zh/guide/cli-generator.md"},_=a({...c,setup(l){return(n,d)=>(i(),t("div",null,[s,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
import{C as e}from"./chunks/CliGenerator.ByPVB1Zk.js";import{d as a,c as t,I as o,a1 as r,o as i}from"./chunks/framework.gjrnbxUT.js";const s=r('<h1 id="cli-编译命令生成器" tabindex="-1">CLI 编译命令生成器 <a class="header-anchor" href="#cli-编译命令生成器" aria-label="Permalink to "CLI 编译命令生成器""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>下面选择扩展可能包含所选操作系统不支持的扩展,这可能导致编译失败。请先查阅 <a href="./extensions.html">支持的扩展</a>。</p></div>',2),p=JSON.parse('{"title":"CLI 编译命令生成器","description":"","frontmatter":{"aside":false},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),c={name:"zh/guide/cli-generator.md"},_=a({...c,setup(l){return(n,d)=>(i(),t("div",null,[s,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
1
assets/zh_guide_deps-map.md.UWX1b51U.js
Normal file
1
assets/zh_guide_deps-map.md.UWX1b51U.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{_ as t}from"./chunks/SearchTable.B5gzMFOw.js";import{c as a,I as i,a1 as e,o as s}from"./chunks/framework.gjrnbxUT.js";const c=e('<h1 id="扩展列表" tabindex="-1">扩展列表 <a class="header-anchor" href="#扩展列表" aria-label="Permalink to "扩展列表""></a></h1><blockquote><ul><li><code>yes</code>: 已支持</li><li>空白: 目前还不支持,或正在支持中</li><li><code>no</code> with issue link: 确定不支持或无法支持</li><li><code>partial</code> with issue link: 已支持,但是无法完美工作</li></ul></blockquote>',2),o=e('<div class="tip custom-block"><p class="custom-block-title">TIP</p><p>如果缺少您需要的扩展,您可以创建 <a href="https://github.com/crazywhalecc/static-php-cli/issues" target="_blank" rel="noreferrer">功能请求</a>。</p><p>有些扩展或扩展依赖的库会有一些可选的特性,例如 gd 库可选支持 libwebp、freetype 等。 如果你只使用 <code>bin/spc build gd --build-cli</code> 是不会包含它们(static-php-cli 默认为最小依赖原则)。</p><p>有关编译可选库,请参考 <a href="./deps-map.html">扩展、库的依赖关系图表</a>。对于可选的库,你也可以从 <a href="./cli-generator.html">编译命令生成器</a> 中选择扩展后展开选择可选库。</p></div>',1),h=JSON.parse('{"title":"扩展列表","description":"","frontmatter":{},"headers":[],"relativePath":"zh/guide/extensions.md","filePath":"zh/guide/extensions.md"}'),l={name:"zh/guide/extensions.md"},u=Object.assign(l,{setup(_){return(r,d)=>(s(),a("div",null,[c,i(t),o]))}});export{h as __pageData,u as default};
|
||||
import{_ as t}from"./chunks/SearchTable.CyGlUrS0.js";import{c as a,I as i,a1 as e,o as s}from"./chunks/framework.gjrnbxUT.js";const c=e('<h1 id="扩展列表" tabindex="-1">扩展列表 <a class="header-anchor" href="#扩展列表" aria-label="Permalink to "扩展列表""></a></h1><blockquote><ul><li><code>yes</code>: 已支持</li><li>空白: 目前还不支持,或正在支持中</li><li><code>no</code> with issue link: 确定不支持或无法支持</li><li><code>partial</code> with issue link: 已支持,但是无法完美工作</li></ul></blockquote>',2),o=e('<div class="tip custom-block"><p class="custom-block-title">TIP</p><p>如果缺少您需要的扩展,您可以创建 <a href="https://github.com/crazywhalecc/static-php-cli/issues" target="_blank" rel="noreferrer">功能请求</a>。</p><p>有些扩展或扩展依赖的库会有一些可选的特性,例如 gd 库可选支持 libwebp、freetype 等。 如果你只使用 <code>bin/spc build gd --build-cli</code> 是不会包含它们(static-php-cli 默认为最小依赖原则)。</p><p>有关编译可选库,请参考 <a href="./deps-map.html">扩展、库的依赖关系图表</a>。对于可选的库,你也可以从 <a href="./cli-generator.html">编译命令生成器</a> 中选择扩展后展开选择可选库。</p></div>',1),h=JSON.parse('{"title":"扩展列表","description":"","frontmatter":{},"headers":[],"relativePath":"zh/guide/extensions.md","filePath":"zh/guide/extensions.md"}'),l={name:"zh/guide/extensions.md"},u=Object.assign(l,{setup(_){return(r,d)=>(s(),a("div",null,[c,i(t),o]))}});export{h as __pageData,u as default};
|
||||
@ -1 +1 @@
|
||||
import{_ as t}from"./chunks/SearchTable.B5gzMFOw.js";import{c as a,I as i,a1 as e,o as s}from"./chunks/framework.gjrnbxUT.js";const c=e("",2),o=e("",1),h=JSON.parse('{"title":"扩展列表","description":"","frontmatter":{},"headers":[],"relativePath":"zh/guide/extensions.md","filePath":"zh/guide/extensions.md"}'),l={name:"zh/guide/extensions.md"},u=Object.assign(l,{setup(_){return(r,d)=>(s(),a("div",null,[c,i(t),o]))}});export{h as __pageData,u as default};
|
||||
import{_ as t}from"./chunks/SearchTable.CyGlUrS0.js";import{c as a,I as i,a1 as e,o as s}from"./chunks/framework.gjrnbxUT.js";const c=e("",2),o=e("",1),h=JSON.parse('{"title":"扩展列表","description":"","frontmatter":{},"headers":[],"relativePath":"zh/guide/extensions.md","filePath":"zh/guide/extensions.md"}'),l={name:"zh/guide/extensions.md"},u=Object.assign(l,{setup(_){return(r,d)=>(s(),a("div",null,[c,i(t),o]))}});export{h as __pageData,u as default};
|
||||
@ -20,20 +20,17 @@ import{_ as s,c as i,o as a,a1 as n}from"./chunks/framework.gjrnbxUT.js";const g
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> static-php-cli</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 你需要先安装 PHP 环境后再运行 Composer 和本项目,安装方式可参考下面。</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">composer</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> update</span></span></code></pre></div><h3 id="使用系统-php-环境" tabindex="-1">使用系统 PHP 环境 <a class="header-anchor" href="#使用系统-php-环境" aria-label="Permalink to "使用系统 PHP 环境""></a></h3><p>下面是系统安装 PHP、Composer 的一些示例命令。具体安装方式建议自行搜索或询问 AI 搜索引擎获取答案,这里不多赘述。</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># [macOS], 需要先安装 Homebrew. See https://brew.sh/</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">composer</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> update</span></span></code></pre></div><h3 id="使用预编译静态-php-二进制运行-static-php-cli" tabindex="-1">使用预编译静态 PHP 二进制运行 static-php-cli <a class="header-anchor" href="#使用预编译静态-php-二进制运行-static-php-cli" aria-label="Permalink to "使用预编译静态 PHP 二进制运行 static-php-cli""></a></h3><p>如果你不想使用 Docker、在系统内安装 PHP,可以直接下载本项目自身编译好的 php 二进制 cli 程序。使用流程如下:</p><p>使用命令部署环境,此脚本会从 <a href="https://dl.static-php.dev/static-php-cli/" target="_blank" rel="noreferrer">自托管的服务器</a> 下载一个当前操作系统的 php-cli 包, 并从 <a href="https://getcomposer.org/download/latest-stable/composer.phar" target="_blank" rel="noreferrer">getcomposer</a> 或 <a href="https://mirrors.aliyun.com/composer/composer.phar" target="_blank" rel="noreferrer">Aliyun(镜像)</a> 下载 Composer。</p><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>使用预编译静态 PHP 二进制目前仅支持 Linux 和 macOS。FreeBSD 环境因为缺少自动化构建环境,所以暂不支持。</p></div><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/setup-runtime</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;">bin/setup-runtime</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --mirror</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> china</span></span></code></pre></div><p>此脚本总共会下载两个文件:<code>bin/php</code> 和 <code>bin/composer</code>,下载完成后,有两种使用方式:</p><ol><li>将 <code>bin/</code> 目录添加到 PATH 路径中:<code>export PATH="/path/to/your/static-php-cli/bin:$PATH"</code>,添加路径后,相当于系统安装了 PHP,可直接使用 <code>composer</code>、<code>php -v</code> 等命令,也可以直接使用 <code>bin/spc</code>。</li><li>直接调用,比如执行 static-php-cli 命令:<code>bin/php bin/spc --help</code>,执行 Composer:<code>bin/php bin/composer update</code>。</li></ol><h3 id="使用-docker-环境" tabindex="-1">使用 Docker 环境 <a class="header-anchor" href="#使用-docker-环境" aria-label="Permalink to "使用 Docker 环境""></a></h3><p>如果你不愿意在系统安装 PHP 和 Composer 运行环境,可以使用内置的 Docker 环境构建脚本。</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 直接使用,将所有使用的命令中 \`bin/spc\` 替换为 \`bin/spc-alpine-docker\` 即可</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc-alpine-docker</span></span></code></pre></div><p>首次执行命令会使用 <code>docker build</code> 构建一个 Docker 镜像,默认构建的 Docker 镜像为 <code>x86_64</code> 架构,镜像名称为 <code>cwcc-spc-x86_64</code>。</p><p>如果你想在 <code>x86_64</code> 环境下构建 <code>aarch64</code> 的 static-php-cli,可以使用 qemu 模拟 arm 镜像运行 Docker,但速度会非常慢。使用参数:<code>SPC_USE_ARCH=aarch64 bin/spc-alpine-docker</code>。</p><p>如果运行后提示需要 sudo 才能运行,执行一次以下命令可授予 static-php-cli 执行 sudo 的权限:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> SPC_USE_SUDO</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">yes</span></span></code></pre></div><h3 id="使用系统-php-环境" tabindex="-1">使用系统 PHP 环境 <a class="header-anchor" href="#使用系统-php-环境" aria-label="Permalink to "使用系统 PHP 环境""></a></h3><p>下面是系统安装 PHP、Composer 的一些示例命令。具体安装方式建议自行搜索或询问 AI 搜索引擎获取答案,这里不多赘述。</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># [macOS], 需要先安装 Homebrew. See https://brew.sh/</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Remember change your composer executable path. For M1/M2 Chip mac, "/opt/homebrew/bin/", for Intel mac, "/usr/local/bin/". Or add it to your own path.</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">brew</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> wget</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">wget</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://getcomposer.org/download/latest-stable/composer.phar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -O</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /path/to/your/bin/composer</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> && </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">chmod</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> +x</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /path/to/your/bin/composer</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># [Debian], you need to make sure your php version >= 8.1 and composer >= 2.0</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> apt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php-cli</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> composer</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php-tokenizer</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># [Alpine]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">apk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> add</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> bash</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> file</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> wget</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> xz</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-common</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-pcntl</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-tokenizer</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-phar</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-posix</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php81-xml</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> composer</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>目前 Ubuntu 部分版本的 apt 安装的 php 版本较旧,故不提供安装命令。如有需要,建议先添加 ppa 等软件源后,安装最新版的 PHP 以及 tokenizer、xml、phar 扩展。</p><p>较老版本的 Debian 默认安装的可能为旧版本(<= 7.4)版本的 PHP,建议先升级 Debian。</p></div><h3 id="使用-docker-环境" tabindex="-1">使用 Docker 环境 <a class="header-anchor" href="#使用-docker-环境" aria-label="Permalink to "使用 Docker 环境""></a></h3><p>如果你不愿意在系统安装 PHP 和 Composer 运行环境,可以使用内置的 Docker 环境构建脚本。</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 直接使用,将所有使用的命令中 \`bin/spc\` 替换为 \`bin/spc-alpine-docker\` 即可</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc-alpine-docker</span></span></code></pre></div><p>首次执行命令会使用 <code>docker build</code> 构建一个 Docker 镜像,默认构建的 Docker 镜像为 <code>x86_64</code> 架构,镜像名称为 <code>cwcc-spc-x86_64</code>。</p><p>如果你想在 <code>x86_64</code> 环境下构建 <code>aarch64</code> 的 static-php-cli,可以使用 qemu 模拟 arm 镜像运行 Docker,但速度会非常慢。使用参数:<code>SPC_USE_ARCH=aarch64 bin/spc-alpine-docker</code>。</p><p>如果运行后提示需要 sudo 才能运行,执行一次以下命令可授予 static-php-cli 执行 sudo 的权限:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> SPC_USE_SUDO</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">yes</span></span></code></pre></div><h3 id="使用预编译静态-php-二进制" tabindex="-1">使用预编译静态 PHP 二进制 <a class="header-anchor" href="#使用预编译静态-php-二进制" aria-label="Permalink to "使用预编译静态 PHP 二进制""></a></h3><p>如果你不想使用 Docker、在系统内安装 PHP,可以直接下载本项目自身编译好的 php 二进制 cli 程序。使用流程如下:</p><p>使用命令部署环境,此脚本会从 <a href="https://dl.static-php.dev/static-php-cli/" target="_blank" rel="noreferrer">自托管的服务器</a> 下载一个当前操作系统的 php-cli 包, 并从 <a href="https://getcomposer.org/download/latest-stable/composer.phar" target="_blank" rel="noreferrer">getcomposer</a> 或 <a href="https://mirrors.aliyun.com/composer/composer.phar" target="_blank" rel="noreferrer">Aliyun(镜像)</a> 下载 Composer。</p><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>使用预编译静态 PHP 二进制目前仅支持 Linux 和 macOS。FreeBSD 环境因为缺少自动化构建环境,所以暂不支持。</p></div><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/setup-runtime</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;">bin/setup-runtime</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --mirror</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> china</span></span></code></pre></div><p>此脚本总共会下载两个文件:<code>bin/php</code> 和 <code>bin/composer</code>,下载完成后,有两种使用方式:</p><ol><li>将 <code>bin/</code> 目录添加到 PATH 路径中:<code>export PATH="/path/to/your/static-php-cli/bin:$PATH"</code>,添加路径后,相当于系统安装了 PHP,可直接使用 <code>composer</code>、<code>php -v</code> 等命令,也可以直接使用 <code>bin/spc</code>。</li><li>直接调用,比如执行 static-php-cli 命令:<code>bin/php bin/spc --help</code>,执行 Composer:<code>bin/php bin/composer update</code>。</li></ol><h2 id="命令-download-下载依赖包" tabindex="-1">命令 download - 下载依赖包 <a class="header-anchor" href="#命令-download-下载依赖包" aria-label="Permalink to "命令 download - 下载依赖包""></a></h2><p>使用命令 <code>bin/spc download</code> 可以下载编译需要的源代码,包括 php-src 以及依赖的各种库的源码。</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 仅下载要编译的扩展及依赖库(使用扩展名,包含可选库)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># [Debian], you need to make sure your php version >= 8.4 and composer >= 2.0</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> apt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php-cli</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> composer</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php-tokenizer</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>目前 Ubuntu 部分版本的 apt 安装的 php 版本较旧,故不提供安装命令。如有需要,建议先添加 ppa 等软件源后,安装最新版的 PHP 以及 tokenizer、xml、phar 扩展。</p><p>较老版本的 Debian 默认安装的可能为旧版本(<= 8.3)版本的 PHP,建议先升级 Debian 或使用 Docker 或自带的静态二进制环境。</p></div><h2 id="命令-download-下载依赖包" tabindex="-1">命令 download - 下载依赖包 <a class="header-anchor" href="#命令-download-下载依赖包" aria-label="Permalink to "命令 download - 下载依赖包""></a></h2><p>使用命令 <code>bin/spc download</code> 可以下载编译需要的源代码,包括 php-src 以及依赖的各种库的源码。</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><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>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"en_develop_php-src-changes.md":"DLlooohw","en_develop_doctor-module.md":"DGd8PeM_","en_contributing_index.md":"CsY8mx8F","en_guide_extension-notes.md":"BaBSDnpT","en_guide_build-on-windows.md":"0XosmiyO","en_guide_cli-generator.md":"DsQUY_G0","zh_develop_index.md":"-CPpDfMx","zh_develop_doctor-module.md":"DgFAPT6E","en_guide_manual-build.md":"C-MJHVXA","zh_develop_php-src-changes.md":"Df0-NcBw","extensions.md":"BOvD4zE9","en_develop_index.md":"B7_c9YYa","en_guide_index.md":"CjOUKFgy","en_guide_action-build.md":"BKamBazh","en_faq_index.md":"DLWPz-7S","deps-map-lib.md":"CHkEUaxl","en_guide_extensions.md":"C5vF7yDY","en_guide_env-vars.md":"DXDG6yvH","en_develop_structure.md":"BA5PDIse","en_develop_source-module.md":"CdOHR0ez","en_index.md":"Cbpb4iAg","extension-notes.md":"Bw8xYOie","en_guide_troubleshooting.md":"9z66WsuC","zh_contributing_index.md":"BvgdahxO","deps-map-ext.md":"Ct90_tZH","zh_guide_env-vars.md":"CfYA93uA","zh_guide_extensions.md":"A3n52TMR","zh_guide_build-on-windows.md":"BxVEYT8r","zh_guide_deps-map.md":"b1yfT0cS","zh_guide_extension-notes.md":"Bk8p1Uuk","zh_guide_index.md":"20ged7P4","zh_guide_troubleshooting.md":"DsBZI1Y4","zh_develop_source-module.md":"D0odLsHX","zh_index.md":"LslJ1UMp","en_guide_deps-map.md":"BMawLo1f","en_develop_system-build-tools.md":"D6vaAwN3","zh_faq_index.md":"DL8Ncj95","zh_develop_system-build-tools.md":"Ds53VEw1","zh_guide_manual-build.md":"BXKvCcei","zh_guide_cli-generator.md":"B7mYo4Lw","zh_guide_action-build.md":"DWMlBDvT","index.md":"mKXtywCA","zh_develop_structure.md":"B-0RMSSw"}
|
||||
{"zh_faq_index.md":"DL8Ncj95","deps-map-lib.md":"CHkEUaxl","extensions.md":"BOvD4zE9","en_develop_index.md":"B7_c9YYa","en_develop_doctor-module.md":"DGd8PeM_","en_faq_index.md":"DLWPz-7S","en_guide_cli-generator.md":"xEZhv-_Y","zh_develop_index.md":"-CPpDfMx","en_index.md":"Cbpb4iAg","en_guide_deps-map.md":"CqlUBlcY","zh_guide_env-vars.md":"CfYA93uA","zh_develop_system-build-tools.md":"Ds53VEw1","zh_guide_extensions.md":"CR9s6CxE","zh_guide_action-build.md":"DWMlBDvT","deps-map-ext.md":"CLNwni-7","en_guide_troubleshooting.md":"9z66WsuC","en_guide_action-build.md":"BKamBazh","en_guide_build-on-windows.md":"0XosmiyO","en_contributing_index.md":"CsY8mx8F","zh_develop_source-module.md":"D0odLsHX","en_guide_extension-notes.md":"BaBSDnpT","en_guide_extensions.md":"CNECRpOR","en_develop_system-build-tools.md":"D6vaAwN3","zh_guide_deps-map.md":"UWX1b51U","zh_guide_troubleshooting.md":"DsBZI1Y4","index.md":"mKXtywCA","zh_contributing_index.md":"BvgdahxO","zh_develop_structure.md":"B-0RMSSw","en_guide_manual-build.md":"C-VHJ_6X","zh_guide_extension-notes.md":"Bk8p1Uuk","zh_develop_php-src-changes.md":"Df0-NcBw","extension-notes.md":"Bw8xYOie","zh_index.md":"LslJ1UMp","en_develop_php-src-changes.md":"DLlooohw","zh_develop_doctor-module.md":"DgFAPT6E","zh_guide_cli-generator.md":"CVhhOKTB","en_develop_structure.md":"BA5PDIse","zh_guide_build-on-windows.md":"BxVEYT8r","en_develop_source-module.md":"CdOHR0ez","zh_guide_manual-build.md":"DVwBMluu","en_guide_index.md":"CjOUKFgy","zh_guide_index.md":"20ged7P4","en_guide_env-vars.md":"DXDG6yvH"}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user