2025-08-31 05:45:13 +00:00
import { _ as e , c as s , o as a , ah as t } from "./chunks/framework.Bhsyh9kO.js" ; const k = JSON . parse ( '{"title":"Build on Windows","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/build-on-windows.md","filePath":"en/guide/build-on-windows.md"}' ) , l = { name : "en/guide/build-on-windows.md" } ; function o ( n , i , h , d , r , p ) { return a ( ) , s ( "div" , null , [ ... i [ 0 ] || ( i [ 0 ] = [ t ( ` <h1 id="build-on-windows" tabindex="-1">Build on Windows <a class="header-anchor" href="#build-on-windows" aria-label="Permalink to “Build on Windows”"> </a></h1><p>Because the Windows system is an NT kernel, the compilation tools and operating system interfaces used by Unix-like operating systems are almost completely different, so the build process on Windows will be slightly different from that of Unix systems.</p><h2 id="github-actions-build" tabindex="-1">GitHub Actions Build <a class="header-anchor" href="#github-actions-build" aria-label="Permalink to “GitHub Actions Build”"> </a></h2><p>Building the Windows version of static-php from Actions is now supported. Like Linux and macOS, you need to Fork the static-php-cli repository to your GitHub account first, then you can enter <a href="./extensions.html">Extension List</a> to select the extension to be compiled, and then go to your own <code>CI on Windows</code> select the PHP version, fill in the extension list (comma separated), and click Run.</p><p>If you're going to develop or build locally, please read on.</p><h2 id="requirements" tabindex="-1">Requirements <a class="header-anchor" href="#requirements" aria-label="Permalink to “Requirements”"> </a></h2><p>The tools required to build static PHP on Windows are the same as PHP's official Windows build tools. You can read <a href="https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2" target="_blank" rel="noreferrer">Official Documentation</a>.</p><p>To sum up, you need the following environment and tools:</p><ul><li>Windows 10/11 (requires build 17063 or later)</li><li>Visual Studio 2019/2022 (recommended 2022)</li><li>C++ desktop development for Visual Studio</li><li>Git for Windows</li><li><a href="https://github.com/php/php-sdk-binary-tools" target="_blank" rel="noreferrer">php-sdk-binary-tools</a> (can be installed automatically using doctor)</li><li>strawberry-perl (can be installed automatically using doctor)</li><li>nasm (can be installed automatically using doctor)</li></ul><div class="tip custom-block"><p class="custom-block-title custom-block-title-default">TIP</p><p>The construction of static-php-cli on Windows refers to using MSVC to build PHP and is not based on MinGW, Cygwin, WSL and other environments.</p><p>If you prefer to use WSL, please refer to the chapter on Building on Linux.</p></div><p>After installing Visual Studio and selecting the C++ desktop development workload, you may download about 8GB of compilation tools, and the download speed depends on your network conditions.</p><h3 id="install-git" tabindex="-1">Install Git <a class="header-anchor" href="#install-git" aria-label="Permalink to “Install Git”"> </a></h3><p>Git for Windows can be downloaded and installed from <a href="https://git-scm.com/download/win" target="_blank" rel="noreferrer">here</a> <code>Standalone Installer 64-bit</code> version, installed in the default location (<code>C: \\ Program Files \\ Git \\ </code>). If you don't want to download and install manually, you can also use Visual Studio Installer and check Git in the <strong>Individual component</strong> tab.</p><h3 id="prepare-static-php-cli" tabindex="-1">Prepare static-php-cli <a class="header-anchor" href="#prepare-static-php-cli" aria-label="Permalink to “Prepare static-php-cli”"> </a></h3><p>Downloading the static-php-cli project is very simple, just use git clone. It is recommended to place the project in <code>C: \\ spc-build \\ </code> or a similar directory. It is best <strong>not to have spaces in the path</strong>.</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-theme
2025-06-12 04:49:10 +00:00
< span class = "line" > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > cd < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > C : < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > \ \ s < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > p c - b u i l d < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > git < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > c l o n e < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > h t t p s : / / g i t h u b . c o m / c r a z y w h a l e c c / s t a t i c - p h p - c l i . g i t < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > cd < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > s t a t i c - p h p - c l i < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < p > I t i s a b i t s t r a n g e t h a t s t a t i c - p h p - c l i i t s e l f r e q u i r e s a P H P e n v i r o n m e n t , b u t n o w y o u c a n q u i c k l y i n s t a l l t h e P H P e n v i r o n m e n t t h r o u g h a s c r i p t . G e n e r a l l y , y o u r c o m p u t e r w i l l n o t h a v e t h e W i n d o w s v e r s i o n o f P H P i n s t a l l e d , s o w e r e c o m m e n d t h a t y o u u s e < c o d e > b i n / s e t u p - r u n t i m e < / c o d e > d i r e c t l y a f t e r d o w n l o a d i n g s t a t i c - p h p - c l i t o i n s t a l l P H P a n d C o m p o s e r i n t h e c u r r e n t d i r e c t o r y . < / p > < d i v c l a s s = " l a n g u a g e - s h e l l " > < b u t t o n t i t l e = " C o p y C o d e " c l a s s = " c o p y " > < / b u t t o n > < s p a n c l a s s = " l a n g " > s h e l l < / s p a n > < p r e c l a s s = " s h i k i s h i k i - t h e m e s g i t h u b - l i g h t g i t h u b - d a r k " s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 e ; - - s h i k i - d a r k : # e 1 e 4 e 8 ; - - s h i k i - l i g h t - b g : # f f f ; - - s h i k i - d a r k - b g : # 2 4 2 9 2 e ; " t a b i n d e x = " 0 " d i r = " l t r " > < c o d e > < s p a n c l a s s = " l i n e " > < s p a n s t y l e = " - - s h i k i - l i g h t : # 6 A 7 3 7 D ; - - s h i k i - d a r k : # 6 A 7 3 7 D ; " > # I n s t a l l P H P a n d C o m p o s e r t o t h e . / r u n t i m e / d i r e c t o r y < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > bin / setup - runtime < / s p a n > < / s p a n >
< span class = "line" > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6A737D;--shiki-dark:#6A737D;" > # After installation , if you need to use PHP and Composer in global commands , < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6A737D;--shiki-dark:#6A737D;" > # use the following command to add the runtime / directory to PATH < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > bin / setup - runtime < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > - a c t i o n < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > a d d - p a t h < / s p a n > < / s p a n >
< span class = "line" > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6A737D;--shiki-dark:#6A737D;" > # Delete the runtime / directory in PATH < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > bin / setup - runtime < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > - a c t i o n < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > r e m o v e - p a t h < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < p > F i n a l l y , n o w t h a t y o u h a v e P H P a n d C o m p o s e r i n s t a l l e d , y o u n e e d t o i n s t a l l s t a t i c - p h p - c l i & # 3 9 ; s C o m p o s e r d e p e n d e n c i e s : < / p > < d i v c l a s s = " l a n g u a g e - s h e l l " > < b u t t o n t i t l e = " C o p y C o d e " c l a s s = " c o p y " > < / b u t t o n > < s p a n c l a s s = " l a n g " > s h e l l < / s p a n > < p r e c l a s s = " s h i k i s h i k i - t h e m e s g i t h u b - l i g h t g i t h u b - d a r k " s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 e ; - - s h i k i - d a r k : # e 1 e 4 e 8 ; - - s h i k i - l i g h t - b g : # f f f ; - - s h i k i - d a r k - b g : # 2 4 2 9 2 e ; " t a b i n d e x = " 0 " d i r = " l t r " > < c o d e > < s p a n c l a s s = " l i n e " > < s p a n s t y l e = " - - s h i k i - l i g h t : # 6 F 4 2 C 1 ; - - s h i k i - d a r k : # B 3 9 2 F 0 ; " > c o m p o s e r < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > i n s t a l l < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < h 3 i d = " i n s t a l l - o t h e r - t o o l s - a u t o m a t i c " t a b i n d e x = " - 1 " > I n s t a l l o t h e r T o o l s ( a u t o m a t i c ) < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # i n s t a l l - o t h e r - t o o l s - a u t o m a t i c " a r i a - l a b e l = " P e r m a l i n k t o “ I n s t a l l o t h e r T o o l s ( a u t o m a t i c ) ” " > < / a > < / h 3 > < p > F o r < c o d e > p h p - s d k - b i n a r y - t o o l s < / c o d e > , < c o d e > s t r a w b e r r y - p e r l < / c o d e > , a n d < c o d e > n a s m < / c o d e > , w e r e c o m m e n d t h a t y o u d i r e c t l y u s e t h e c o m m a n d < c o d e > b i n / s p c d o c t o r < / c o d e > t o c h e c k a n d i n s t a l l t h e m . < / p > < p > I f d o c t o r s u c c e s s f u l l y i n s t a l l s a u t o m a t i c a l l y , p l e a s e < s t r o n g > s k i p < / s t r o n g > t h e s t e p s b e l o w t o m a n u a l l y i n s t a l l t h e a b o v e t o o l s . < / p > < p > B u t i f t h e a u t o m a t i c i n s t a l l a t i o n f a i l s , p l e a s e r e f e r t o t h e m a n u a l i n s t a l l a t i o n m e t h o d b e l o w . < / p > < h 3 i d = " i n s t a l l - p h p - s d k - b i n a r y - t o o l s - m a n u a l " t a b i n d e x = " - 1 " > I n s t a l l p h p - s d k - b i n a r y - t o o l s ( m a n u a l ) < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # i n s t a l l - p h p - s d k - b i n a r y - t o o l s - m a n u a l " a r i a - l a b e l = " P e r m a l i n k t o “ I n s t a l l p h p - s d k - b i n a r y - t o o l s ( m a n u a l ) ” " > < / a > < / h 3 > < d i v c l a s s = " l a n g u a g e - s h e l l " > < b u t t o n t i t l e = " C o p y C o d e " c l a s s = " c o p y " > < / b u t t o n > < s p a n c l a s s = " l a n g " > s h e l l < / s p a n > < p r e c l a s s = " s h i k i s h i k i - t h e m e s g i t h u b - l i g h t g i t h u b - d a r k " s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 e ; - - s h i k i - d a r k : # e 1 e 4 e 8 ; - - s h i k i - l i g h t - b g : # f f f ; - - s h i k i - d a r k - b g : # 2 4 2 9 2 e ; " t a b i n d e x = " 0 " d i r = " l t r " > < c o d e > < s p a n c l a s s = " l i n e " > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > c d < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > C : < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > \ \ s < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > p c - b u i l d < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > \ \ s < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > t a t i c - p h p - c l i < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > git < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > c l o n e < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > h t t p s : / / g i t h u b . c o m / p h p / p h p - s d k - b i n a r y - t o o l s . g i t < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < b l o c k q u o t e > < p > Y o u c a n a l s o s e t t h e g l o b a l v a r i a b l e < c o d e > P H P _ S D K _ P A T H < / c o d e > i n W i n d o w s s e t t i n g s a n d c l o n e t h e p r o j e c t t o t h e p a t h c o r r e s p o n d i n g t o t h e v a r i a b l e . U n d e r n o r m a l c i r c u m s t a n c e s , y o u d o n & # 3 9 ; t n e e d t o c h a n g e i t . < / p > < / b l o c k q u o t e > < h 3 i d = " i n s t a l l - s t r a w b e r r y - p e r l - m a n u a l " t a b i n d e x = " - 1 " > I n s t a l l s t r a w b e r r y - p e r l ( m a n u a l ) < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # i n s t a l l - s t r a w b e r r y - p e r l - m a n u a l " a r i a - l a b e l = " P e r m a l i n k t o “ I n s t a l l s t r a w b e r r y - p e r l ( m a n u a l ) ” " > < / a > < / h 3 > < b l o c k q u o t e > < p > I f y o u d o n & # 3 9 ; t n e e d t o c o m p i l e t h e o p e n s s l e x t e n s i o n , y o u d o n & # 3 9 ; t n e e d t o i n s t a l l p e r l . < / p > < / b l o c k q u o t e > < o l > < l i > D o w n l o a d t h e l a t e s t v e r s i o n o f s t r a w b e r r y - p e r l f r o m < a h r e f = " h t t p s : / / g i t h u b . c o m / S t r a w b e r r y P e r l / P e r l - D i s t - S t r a w b e r r y / r e l e a s e s / " t a r g e t = " _ b l a n k " r e l = " n o r e f e r r e r " > G i t H u b < / a > . < / l i > < l i > I n s t a l l t o t h e < c o d e > C : \ \ s p c - b u i l d \ \ s t a t i c - p h p - c l i \ \ p k g r o o t \ \ p e r l \ \ < / c o d e > d i r e c t o r y . < / l i > < / o l > < b l o c k q u o t e > < p > Y o u c a n d o w n l o a d t h e < c o d e > - p o r t a b l e < / c o d e > v e r s i o n a n d e x t r a c t i t d i r e c t l y t o t h e a b o v e d i r e c t o r y . T h e l a s t < c o d e > p e r l . e x e < / c o d e > s h o u l d b e l o c a t e d a t < c o d e > C : \ \ s p c - b u i l d \ \ s t a t i c - p h p - c l i \ \ p k g r o o t \ \ p e r l \ \ p e r l \ \ b i n \ \ p e r l . e x e < / c o d e > . < / p > < / b l o c k q u o t e > < h 3 i d = " i n s t a l l - n a s m - m a n u a l " t a b i n d e x = " - 1 " > I n s t a l l n a s m ( m a n u a l ) < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # i n s t a l l - n a s m - m a n u a l " a r i a - l a b e l = " P e r m a l i n k t o “ I n s t a l l n a s m ( m a n u a l ) ” " > < / a > < / h 3 > < b l o c k q u o t e > < p > I f y o u d o n & # 3 9 ; t n e e d t o c o m p i l e o p e n s s l e x t e n s i o n , y o u d o n & # 3 9 ; t n e e d t o i n s t a l l n a s m . < / p > < / b l o c k q u o t e > < o l > < l i > D o w n l o a d t h e n a s m t o o l ( x 6 4 ) f r o m < a h r e f = " h t t p s : / / w w w . n a s m . u s / p u b / n a s m / r e l e a s e b u i l d s / " t a r g e t = " _ b l a n k " r e l = " n o r e f e r r e r " > o f f i c i a l w e b s i t e < / a > . < / l i > < l i > P l a c e < c o d e > n a s m . e x e < / c o d e > a n d < c o d e > n d i s a s m . e x e < / c o d e > i n t h e < c o d e > C : \ \ s p c - b u i l d \ \ s t a t i c - p h p - c l i \ \ p h p - s d k - b i n a r y - t o o l s \ \ b i n \ \ < / c o d e > d i r e c t o r y . < / l i > < / o l > < h 2 i d = " d o w n l o a d - r e q u i r e d - s o u r c e s " t a b i n d e x = " - 1 " > D o w n l o a d r e q u i r e d s o u r c e s < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # d o w n l o a d - r e q u i r e d - s o u r c e s " a r i a - l a b e l = " P e r m a l i n k t o “ D o w n l o a d r e q u i r e d s o u r c e s ” " > < / a > < / h 2 > < p > S a m e a s < a h r e f = " . / m a n u a l - b u i l d . h t m l # c o m m a n d - d o w n l o a d " > M a n u a l b u i l d - D o w n l o a d < / a > < / p > < h 2 i d = " b u i l d - p h p " t a b i n d e x = " - 1 " > B u i l d P H P < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # b u i l d - p h p " a r i a - l a b e l = " P e r m a l i n k t o “ B u i l d P H P ” " > < / a > < / h 2 > < p > U s e t h e b u i l d c o m m a n d t o s t a r t b u i l d i n g t h e s t a t i c p h p b i n a r y . B e f o r e e x e c u t i n g t h e < c o d e > b i n / s p c b u i l d < / c o d e > c o m m a n d , b e s u r e t o u s e t h e < c o d e > d o w n l o a d < / c o d e > c o m m a n d t o d o w n l o a d s o u r c e s . I t i s r e c o m m e n d e d t o u s e < c o d e > d o c t o r < / c o d e > t o c h e c k t h e e n v i r o n m e n t . < / p > < h 3 i d = " b u i l d - s a p i " t a b i n d e x = " - 1 " > B u i l d S A P I < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # b u i l d - s a p i " a r i a - l a b e l = " P e r m a l i n k t o “ B u i l d S A P I ” " > < / a > < / h 3 > < p > Y o u n e e d t o g o t o < a h r e f = " . / e x t e n s i o n s . h t m l " > E x t e n s i o n L i s t < / a > o r < a h r e f = " . / c l i - g e n e r a t o r . h t m l " > C o m m a n d G e n e r a t o r < / a > t o s e l e c t t h e e x t e n s i o n y o u w a n t t o a d d , a n d t h e n u s e t h e c o m m a n d < c o d e > b i n / s p c b u i l d < / c o d e > t o c o m p i l e . Y o u n e e d t o s p e c i f y t a r g e t s , c h o o s e f r o m t h e f o l l o w i n g p a r a m e t e r s ( a t l e a s t o n e ) : < / p > < u l > < l i > < c o d e > - - b u i l d - c l i < / c o d e > : B u i l d a c l i s a p i ( c o m m a n d l i n e i n t e r f a c e , w h i c h c a n e x e c u t e P H P c o d e o n t h e c o m m a n d l i n e ) < / l i > < l i > < c o d e > - - b u i l d - m i c r o < / c o d e > : B u i l d a m i c r o s a p i ( u s e d t o b u i l d a s t a n d a l o n e e x e c u t a b l e b i n a r y c o n t a i n i n g P H P c o d e ) < / l i > < / u l > < d i v c l a s s = " l a n g u a g e - s h e l l " > < b u t t o n t i t l e = " C o p y C o d e " c l a s s = " c o p y " > < / b u t t o n > < s p a n c l a s s = " l a n g " > s h e l l < / s p a n > < p r e c l a s s = " s h i k i s h i k i - t h e m e s g i t h u b - l i g h t g i t h u b - d a r k " s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 e ; - - s h i k i - d a r k : # e 1 e 4 e 8 ; - - s h i k i - l i g h t - b g : # f f f ; - - s h i k i - d a r k - b g : # 2 4 2 9 2 e ; " t a b i n d e x = " 0 " d i r = " l t r " > < c o d e > < s p a n c l a s s = " l i n e " > < s p a n s t y l e = " - - s h i k i - l i g h t : # 6 A 7 3 7 D ; - - s h i k i - d a r k : # 6 A 7 3 7 D ; " > # C o m p i l e P H P w i t h b c m a t h , o p e n s s l , z l i b e x t e n s i o n s , t h e c o m p i l a t i o n t a r g e t i s c l i < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > bin / spc < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > b u i l d < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > & q u o t ; b c m a t h , o p e n s s l , z l i b & q u o t ; < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > - - b u i l d - c l i < / s p a n > < / s p a n >
< span class = "line" > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6A737D;--shiki-dark:#6A737D;" > # Compile PHP with phar , curl , posix , pcntl , tokenizer extensions , compile target is micro and cli < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > bin / spc < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > b u i l d < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > & q u o t ; b c m a t h , o p e n s s l , z l i b & q u o t ; < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > - - b u i l d - m i c r o < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > - - b u i l d - c l i < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < d i v c l a s s = " w a r n i n g c u s t o m - b l o c k " > < p c l a s s = " c u s t o m - b l o c k - t i t l e c u s t o m - b l o c k - t i t l e - d e f a u l t " > W A R N I N G < / p > < p > I n W i n d o w s , i t i s b e s t t o u s e d o u b l e q u o t e s t o w r a p p a r a m e t e r s c o n t a i n i n g c o m m a s , s u c h a s < c o d e > & q u o t ; b c m a t h , o p e n s s l , m b s t r i n g & q u o t ; < / c o d e > . < / p > < / d i v > < h 3 i d = " d e b u g " t a b i n d e x = " - 1 " > D e b u g < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # d e b u g " a r i a - l a b e l = " P e r m a l i n k t o “ D e b u g ” " > < / a > < / h 3 > < p > I f y o u e n c o u n t e r p r o b l e m s d u r i n g t h e c o m p i l a t i o n p r o c e s s , o r w a n t t o v i e w e a c h e x e c u t i n g s h e l l c o m m a n d , y o u c a n u s e < c o d e > - - d e b u g < / c o d e > t o e n a b l e d e b u g m o d e a n d v i e w a l l t e r m i n a l l o g s : < / p > < d i v c l a s s = " l a n g u a g e - s h e l l " > < b u t t o n t i t l e = " C o p y C o d e " c l a s s = " c o p y " > < / b u t t o n > < s p a n c l a s s = " l a n g " > s h e l l < / s p a n > < p r e c l a s s = " s h i k i s h i k i - t h e m e s g i t h u b - l i g h t g i t h u b - d a r k " s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 e ; - - s h i k i - d a r k : # e 1 e 4 e 8 ; - - s h i k i - l i g h t - b g : # f f f ; - - s h i k i - d a r k - b g : # 2 4 2 9 2 e ; " t a b i n d e x = " 0 " d i r = " l t r " > < c o d e > < s p a n c l a s s = " l i n e " > < s p a n s t y l e = " - - s h i k i - l i g h t : # 6 F 4 2 C 1 ; - - s h i k i - d a r k : # B 3 9 2 F 0 ; " > b i n / s p c < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > b u i l d < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > & q u o t ; o p e n s s l & q u o t ; < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > - - b u i l d - c l i < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > - - d e b u g < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < h 3 i d = " b u i l d - o p t i o n s " t a b i n d e x = " - 1 " > B u i l d O p t i o n s < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # b u i l d - o p t i o n s " a r i a - l a b e l = " P e r m a l i n k t o “ B u i l d O p t i o n s ” " > < / a > < / h 3 > < p > D u r i n g t h e c o m p i l a t i o n p r o c e s s , i n s o m e s p e c i a l c a s e s , t h e c o m p i l e r a n d t h e c o n t e n t o f t h e c o m p i l a t i o n d i r e c t o r y n e e d t o b e i n t e r v e n e d . Y o u c a n t r y t o u s e t h e f o l l o w i n g c o m m a n d s : < / p > < u l > < l i > < c o d e > - - w i t h - c l e a n < / c o d e > : c l e a n u p o l d m a k e f i l e s b e f o r e c o m p i l i n g P H P < / l i > < l i > < c o d e > - - e n a b l e - z t s < / c o d e > : M a k e c o m p i l e d P H P t h r e a d - s a f e v e r s i o n ( d e f a u l t i s N T S v e r s i o n ) < / l i > < l i > < c o d e > - - w i t h - l i b s = X X X , Y Y Y < / c o d e > : C o m p i l e t h e s p e c i f i e d d e p e n d e n t l i b r a r y b e f o r e c o m p i l i n g P H P , a n d a c t i v a t e s o m e e x t e n s i o n o p t i o n a l f u n c t i o n s < / l i > < l i > < c o d e > - - w i t h - c o n f i g - f i l e - s c a n - d i r = X X X < / c o d e > : S e t t h e d i r e c t o r y t o s c a n f o r < c o d e > . i n i < / c o d e > f i l e s a f t e r r e a d i n g < c o d e > p h p . i n i < / c o d e > ( C h e c k < a h r e f = " . / . . / f a q / i n d e x . h t m l # w h a t - i s - t h e - p a t h - o f - p h p - i n i " > h e r e < / a > f o r d e f a u l t p a t h s ) < / l i > < l i > < c o d e > - I x x x = y y y < / c o d e > : H a r d c o m p i l e I N I o p t i o n s i n t o P H P b e f o r e c o m p i l i n g ( s u p p o r t m u l t i p l e o p t i o n s , a l i a s i s < c o d e > - - w i t h - h a r d c o d e d - i n i < / c o d e > ) < / l i > < l i > < c o d e > - - w i t h - m i c r o - f a k e - c l i < / c o d e > : W h e n c o m p i l i n g m i c r o , l e t m i c r o & # 3 9 ; s < c o d e > P H P _ S A P I < / c o d e > p r e t e n d t o b e < c o d e > c l i < / c o d e > ( f o r c o m p a t i b i l i t y w i t h s o m e p r o g r a m s t h a t c h e c k < c o d e > P H P _ S A P I < / c o d e > ) < / l i > < l i > < c o d e > - - d i s a b l e - o p c a c h e - j i t < / c o d e > : D i s a b l e o p c a c h e j i t ( e n a b l e d b y d e f a u l t ) < / l i > < l i > < c o d e > - - w i t h o u t - m i c r o - e x t - t e s t < / c o d e > : A f t e r b u i l d i n g m i c r o . s f x , d o n o t t e s t t h e r u n n i n g r e s u l t s o f d i f f e r e n t e x t e n s i o n s i n m i c r o . s f x < / l i > < l i > < c o d e > - - w i t h - s u g g e s t e d - e x t s < / c o d e > : A d d < c o d e > e x t - s u g g e s t s < / c o d e > a s d e p e n d e n c i e s w h e n c o m p i l i n g < / l i > < l i > < c o d e > - - w i t h - s u g g e s t e d - l i b s < / c o d e > : A d d < c o d e > l i b - s u g g e s t s < / c o d e > a s d e p e n d e n c i e s w h e n c o m p i l i n g < / l i > < l i > < c o d e > - - w i t h - u p x - p a c k < / c o d e > : U s e U P X t o r e d u c e t h e s i z e o f t h e b i n a r y f i l e a f t e r c o m p i l a t i o n ( y o u n e e d t o u s e < c o d e > b i n / s p c i n s t a l l - p k g u p x < / c o d e > t o i n s t a l l u p x f i r s t ) < / l i > < l i > < c o d e > - - w i t h - m i c r o - l o g o = X X X . i c o < / c o d e > : C u s t o m i z e t h e i c o n o f t h e < c o d e > e x e < / c o d e > e x e c u t a b l e f i l e a f t e r c u s t o m i z i n g t h e m i c r o b u i l d ( i n t h e f o r m a t o f < c o d e > . i c o < / c o d e > ) < / l i > < / u l > < p > H e r e i s a s i m p l e e x a m p l e w h e r e w e p r e s e t a l a r g e r < c o d e > m e m o r y _ l i m i t < / c o d e > a n d d i s a b l e t h e < c o d e > s y s t e m < / c o d e > f u n c t i o n : < / p > < d i v c l a s s = " l a n g u a g e - s h e l l " > < b u t t o n t i t l e = " C o p y C o d e " c l a s s = " c o p y " > < / b u t t o n > < s p a n c l a s s = " l a n g " > s h e l l < / s p a n > < p r e c l a s s = " s h i k i s h i k i - t h e m e s g i t h u b - l i g h t g i t h u b - d a r k " s t y l e = " -
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > bin / spc < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > m i c r o : c o m b i n e < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > h e l l o . p h p < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6A737D;--shiki-dark:#6A737D;" > # Then we got \ ` my-app.exe \` with custom logo!</span></span>
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > my - app . exe < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < h 2 i d = " u s e - p h p - e x e " t a b i n d e x = " - 1 " > U s e p h p . e x e < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # u s e - p h p - e x e " a r i a - l a b e l = " P e r m a l i n k t o “ U s e p h p . e x e ” " > < / a > < / h 2 > < p > A f t e r p h p . e x e i s c o m p i l e d , i t i s l o c a t e d i n t h e < c o d e > b u i l d r o o t \ \ b i n \ \ < / c o d e > d i r e c t o r y . Y o u c a n c o p y i t t o a n y l o c a t i o n f o r u s e . < / p > < d i v c l a s s = " l a n g u a g e - s h e l l " > < b u t t o n t i t l e = " C o p y C o d e " c l a s s = " c o p y " > < / b u t t o n > < s p a n c l a s s = " l a n g " > s h e l l < / s p a n > < p r e c l a s s = " s h i k i s h i k i - t h e m e s g i t h u b - l i g h t g i t h u b - d a r k " s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 e ; - - s h i k i - d a r k : # e 1 e 4 e 8 ; - - s h i k i - l i g h t - b g : # f f f ; - - s h i k i - d a r k - b g : # 2 4 2 9 2 e ; " t a b i n d e x = " 0 " d i r = " l t r " > < c o d e > < s p a n c l a s s = " l i n e " > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > . < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 E ; - - s h i k i - d a r k : # E 1 E 4 E 8 ; " > \ \ < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > p h p < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > - v < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < h 2 i d = " u s e - m i c r o - s f x " t a b i n d e x = " - 1 " > U s e m i c r o . s f x < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # u s e - m i c r o - s f x " a r i a - l a b e l = " P e r m a l i n k t o “ U s e m i c r o . s f x ” " > < / a > < / h 2 > < b l o c k q u o t e > < p > p h p m i c r o i s a S e l F - e x t r a c t e d e X e c u t a b l e S A P I m o d u l e , p r o v i d e d b y < a h r e f = " h t t p s : / / g i t h u b . c o m / d i x y e s / p h p m i c r o " t a r g e t = " _ b l a n k " r e l = " n o r e f e r r e r " > p h p m i c r o < / a > p r o j e c t . B u t t h i s p r o j e c t i s u s i n g a < a h r e f = " h t t p s : / / g i t h u b . c o m / s t a t i c - p h p / p h p m i c r o " t a r g e t = " _ b l a n k " r e l = " n o r e f e r r e r " > f o r k < / a > o f p h p m i c r o , b e c a u s e w e n e e d t o a d d s o m e f e a t u r e s t o i t . I t c a n p u t p h p r u n t i m e a n d y o u r s o u r c e c o d e t o g e t h e r . < / p > < / b l o c k q u o t e > < p > T h e f i n a l c o m p i l a t i o n r e s u l t w i l l o u t p u t a f i l e n a m e d < c o d e > . / m i c r o . s f x < / c o d e > , w h i c h n e e d s t o b e u s e d w i t h y o u r P H P s o u r c e c o d e l i k e < c o d e > c o d e . p h p < / c o d e > . T h i s f i l e w i l l b e l o c a t e d i n t h e p a t h < c o d e > b u i l d r o o t / b i n / m i c r o . s f x < / c o d e > . < / p > < p > P r e p a r e y o u r p r o j e c t s o u r c e c o d e , w h i c h c a n b e a s i n g l e P H P f i l e o r a P h a r f i l e , f o r u s e . < / p > < b l o c k q u o t e > < p > I f y o u w a n t t o c o m b i n e p h a r f i l e s , y o u m u s t a d d < c o d e > p h a r < / c o d e > e x t e n s i o n w h e n c o m p i l i n g ! < / p > < / b l o c k q u o t e > < d i v c l a s s = " l a n g u a g e - s h e l l " > < b u t t o n t i t l e = " C o p y C o d e " c l a s s = " c o p y " > < / b u t t o n > < s p a n c l a s s = " l a n g " > s h e l l < / s p a n > < p r e c l a s s = " s h i k i s h i k i - t h e m e s g i t h u b - l i g h t g i t h u b - d a r k " s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 e ; - - s h i k i - d a r k : # e 1 e 4 e 8 ; - - s h i k i - l i g h t - b g : # f f f ; - - s h i k i - d a r k - b g : # 2 4 2 9 2 e ; " t a b i n d e x = " 0 " d i r = " l t r " > < c o d e > < s p a n c l a s s = " l i n e " > < s p a n s t y l e = " - - s h i k i - l i g h t : # 6 A 7 3 7 D ; - - s h i k i - d a r k : # 6 A 7 3 7 D ; " > # c o d e . p h p & q u o t ; & l t ; ? p h p e c h o & # 3 9 ; H e l l o w o r l d & # 3 9 ; . P H P _ E O L ; & q u o t ; < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > bin / spc < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > m i c r o : c o m b i n e < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > c o d e . p h p < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 0 5 C C 5 ; - - s h i k i - d a r k : # 7 9 B 8 F F ; " > - O < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > m y - a p p . e x e < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6A737D;--shiki-dark:#6A737D;" > # Run it ! ! ! Copy it to another computer ! ! ! < / s p a n > < / s p a n >
2025-08-31 05:45:13 +00:00
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > . / my - app . exe < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < p > I f y o u p a c k a g e a P H A R f i l e , j u s t r e p l a c e < c o d e > c o d e . p h p < / c o d e > w i t h t h e p h a r f i l e p a t h . Y o u c a n u s e < a h r e f = " h t t p s : / / g i t h u b . c o m / b o x - p r o j e c t / b o x " t a r g e t = " _ b l a n k " r e l = " n o r e f e r r e r " > b o x - p r o j e c t / b o x < / a > t o p a c k a g e y o u r C L I p r o j e c t a s P h a r , I t i s t h e n c o m b i n e d w i t h p h p m i c r o t o p r o d u c e a s t a n d a l o n e e x e c u t a b l e b i n a r y . < / p > < p > F o r m o r e d e t a i l s o n t h e < c o d e > m i c r o : c o m b i n e < / c o d e > c o m m a n d , r e f e r t o < a h r e f = " . / m a n u a l - b u i l d . h t m l " > c o m m a n d < / a > o n U n i x s y s t e m s . < / p > ` , 6 4 ) ] ) ] ) } c o n s t u = e ( l , [ [ " r e n d e r " , o ] ] ) ; e x p o r t { k a s _ _ p a g e D a t a , u a s d e f a u l t } ;