A C standard library and toolchain setup that builds one executable that runs natively on Linux, macOS, Windows, BSDs and BIOS.
crazywhalecc/static-php-cli
A CLI tool that builds standalone, dependency-free PHP binaries with chosen extensions for Linux, macOS and Windows.
- Stars
- 1,967
- Forks
- 433
- Open issues
- 36
- Last commit
- 11 hours ago
What is it?
StaticPHP (the repository is still named static-php-cli) builds portable PHP executables that bundle the PHP interpreter, chosen extensions and related components into a single file. The resulting binaries can be copied to another machine and run without installing PHP or its shared libraries.
You describe the desired PHP version and extension list in a craft.yml file, then run the spc tool to compile. It supports PHP 8.1 through 8.5, with 8.6 in pre-release, and can produce a plain php-cli binary or a phpmicro self-extracting executable that embeds your PHP source code. A built-in environment checker can detect and install missing build dependencies.
The project provides pre-built download combinations of different sizes, and offers a GitHub Actions workflow for building with a custom extension list.
Key features
- 01Builds single-file PHP CLI binaries with no runtime dependencies.
- 02Can package PHP source code into a phpmicro self-extracting executable.
- 03Supports PHP 8.1 to 8.5, with 8.6 in pre-release.
- 04Offers 100+ selectable PHP extensions.
- 05Runs on Linux, macOS and Windows.
- 06Includes a build environment checker with auto-fix.
Use cases
- Shipping a PHP command-line tool to servers without a PHP installation.
- Distributing a PHP application as one executable file to end users.
- Creating slim PHP runtimes for containers or minimal Linux images.
- Producing a PHP build with a specific extension set for a CI pipeline.
Quick start
- 1
Download the spc binary for Linux x86_64
curl -fsSL -o spc https://dl.static-php.dev/v3/spc-bin/nightly/spc-linux-x86_64 - 2
Add execute permission to spc
chmod +x ./spc - 3
Create a craft.yml file listing the PHP version and extensions
- 4
Build static PHP from craft.yml
./spc craft
Things to know
- The v3 branch is not yet an official release, and PHP 8.6 is pre-release.
- Windows builds require Visual Studio 2022 with C++ tools installed first.
In collections
Topics
FAQ
- What is static-php-cli?
- A CLI tool that builds standalone, dependency-free PHP binaries with chosen extensions for Linux, macOS and Windows. StaticPHP (the repository is still named static-php-cli) builds portable PHP executables that bundle the PHP interpreter, chosen extensions and related components into a single file. The resulting binaries can be copied to another machine and run without installing PHP or its shared libraries.
- Is static-php-cli free to use? What license does it have?
- static-php-cli is open source under the MIT license. Check the license terms before using it in commercial products.
- Is static-php-cli still maintained?
- Actively maintained. The last commit to static-php-cli was on Nov 7, 2026.
- What can I use static-php-cli for?
- Shipping a PHP command-line tool to servers without a PHP installation. Distributing a PHP application as one executable file to end users. Creating slim PHP runtimes for containers or minimal Linux images. Producing a PHP build with a specific extension set for a CI pipeline.
- How do I install static-php-cli?
- Download the spc binary for Linux x86_64: curl -fsSL -o spc https://dl.static-php.dev/v3/spc-bin/nightly/spc-linux-x86_64 Add execute permission to spc: chmod +x ./spc Create a craft.yml file listing the PHP version and extensions Build static PHP from craft.yml: ./spc craft
- Where can I get static-php-cli?
- The source code and installation instructions are on GitHub: https://github.com/crazywhalecc/static-php-cli
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A jq-like command-line tool and query language for inspecting and querying binary file formats, with decoders for dozens of formats.
A command-line tool that breaks down the size of compiled Go binaries by package, section and symbol, with text, JSON, HTML, SVG, web and terminal UI output.
A complete toolchain for building, packaging, and publishing Electron desktop applications, from project scaffolding to release.
SCons is a Python-based software construction tool that determines what needs rebuilding and runs the commands to build it.
A modern PHP application server built on the Caddy web server, with worker mode, Early Hints, HTTP/3 and automatic HTTPS.