Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion build-static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ set -o pipefail
# DEBUG_SYMBOLS is set (default: none)
# - MIMALLOC: when set, use mimalloc as the allocator (default: none)
# - OUTPUT_DIR: where to write the resulting binary (default: dist/)
# - SPC: spc binary, or bin/spc of a static-php-cli checkout, to use (default: the nightly)
# - SPC_REGISTRIES: comma-separated static-php-cli registries providing more
# extensions for PHP_EXTENSIONS (read by static-php-cli itself)
# - RELEASE: [maintainer only] create a GitHub release if set to 1 (default: none)
#
# The libc to link against (Linux only) is selected with:
Expand Down Expand Up @@ -110,7 +113,7 @@ if type "brew" >/dev/null 2>&1; then
fi

# Fetch the spc binary if we don't have it yet, falling back to source
spc="${DIST_DIR}/spc"
spc="${SPC:-${DIST_DIR}/spc}"
if [ ! -x "${spc}" ]; then
# the nightly endpoint occasionally answers 500, retry instead of failing the build
if curl -fsSL --retry 5 -o "${spc}" "https://dl.static-php.dev/v3/spc-bin/nightly/spc-${spc_os}-${spc_arch}"; then
Expand Down
13 changes: 13 additions & 0 deletions docs/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ docker run --rm -v "$PWD/output:/output" -e OUTPUT_DIR=/output -e SPC_LOGS_DIR=/
dunglas/frankenphp:static-builder-musl
```

### Third-party and private extensions

Extensions that static-php-cli doesn't know about, including private ones shipped as
prebuilt archives, can be provided by an [external static-php-cli registry](https://static-php.dev/en/develop/registry).
Point `SPC_REGISTRIES` to its declaration file and add the extension to `PHP_EXTENSIONS`:

```console
SPC_REGISTRIES=/path/to/spc.registry.yml PHP_EXTENSIONS=opcache,my_extension ./build-static.sh
```

To use a static-php-cli version other than the nightly binary, for instance a checkout of its
source, set `SPC` to the `spc` binary or to the `bin/spc` script of the checkout.

### Extra Caddy modules

To add extra Caddy modules or pass other arguments to [xcaddy](https://github.com/caddyserver/xcaddy), use the `XCADDY_ARGS` variable:
Expand Down
Loading