On this page

Releases

Open the Download page for Linux, macOS, and Windows binaries, packages, and SHA-256 checksums.

v0.10.0 #

Rapira v0.10.0 moves to a single-process ZTS worker thread runtime and adds gRPC server streaming and remote descriptor URLs. It also adds rapira pack with an in-memory /app VFS, built-in HTTP compression middleware, PHP 8.6, static Linux binaries, and Distroless container images.

Breaking changes and how to upgrade # Breaking

1. Update rapira.toml server and pool keys #

Rapira rejects unknown keys at startup. Apply these renames and removals to rapira.toml:

  • Rename [supervisor] to [server].
  • Rename process_control_timeout_secs to stop_timeout_secs.
  • Rename [http.pool].processes and [grpc.pool].processes to workers.
  • Remove [http.pool].max_memory_mb, [grpc.pool].max_memory_mb, and [http].io_threads.
  • Check relative unix: listen paths in [http], [grpc], and [observability]. They now resolve against the directory of rapira.toml instead of the current working directory.

Before (v0.9):

toml
[supervisor]
pidfile = "/run/rapira.pid"
process_control_timeout_secs = 30

[http]
listen = "127.0.0.1:8000"
io_threads = 2

[http.pool]
entrypoint = "public/index.php"
mode = "worker"
processes = 4
max_memory_mb = 256

After (v0.10):

toml
[server]
pidfile = "/run/rapira.pid"
stop_timeout_secs = 30

[http]
listen = "127.0.0.1:8000"

[http.pool]
entrypoint = "public/index.php"
mode = "worker"
workers = 4

See Configuration for every supported key.

2. Switch self-hosted PHP embeds to ZTS and check OPcache versions #

One server process now runs PHP workers as threads. Release binaries, packages, and container images ship thread-safe (ZTS) PHP.

  • On Linux and macOS source builds, configure PHP with --enable-zts --disable-zend-signals --enable-embed=shared. See Build from source.
  • A custom NTS libphp build on Linux or macOS still runs, but allows only one pool and clamps workers to 1.

OPcache multi-worker requirement

Running more than one worker across all pools with OPcache enabled requires PHP 8.4.29, 8.5.14, 8.6.1, or newer. On older patch releases, set total workers to 1 or set opcache.enable = 0.

3. Update Dockerfiles for complete ZTS images and redis removal #

ghcr.io/rapira-rs/rapira tags (php8.4, php8.5, php8.6) are now complete Debian Trixie ZTS images instead of a scratch payload for COPY --from. They build on the official PHP images (php:8.4-zts-trixie, php:8.5-zts-trixie, and php:8.6-cli-trixie). Rapira also removed the redis PHP extension because redis is unsafe under ZTS PHP.

Replace COPY --from layers with FROM ghcr.io/rapira-rs/rapira:php8.6 or FROM ghcr.io/rapira-rs/rapira:php8.6-distroless:

dockerfile
FROM ghcr.io/rapira-rs/rapira:php8.6
WORKDIR /app
COPY . /app
CMD ["rapira", "serve", "/app/rapira.toml"]

Replace the redis extension with a pure-PHP client such as Predis, or build a ZTS-safe extension. See Docker and Distroless.

4. Remove deleted Prometheus metrics #

Because workers run as threads in one process, Rapira removed these per-process metric families from /metrics:

  • rapira_worker_exits_total
  • rapira_worker_rss_bytes
  • rapira_worker_pss_bytes

Remove these series from Prometheus dashboards and alert rules. Monitor process memory through container or host metrics instead. See Metrics and health checks.

5. Do not retain $call->getResponseMetadata() past call finalization #

In the gRPC plugin, $call->getResponseMetadata() returns the call object itself (UnaryCall or ServerStreamingCall). Do not store that return value in a property or static variable across iterations.

php
$call->getResponseMetadata()->addHeader('x-server', 'rapira');
$call->respond($payload);

See Metadata.

6. Validate Content-Length headers in HTTP Dispatcher mode #

Exchange::writeHead() throws \ValueError if content-length repeats or is not a non-negative integer. Remove duplicate Content-Length entries before calling writeHead(). See Dispatcher mode.


gRPC server streaming and remote descriptor sets # Major feature

Rapira serves server-streaming RPCs over gRPC, binary gRPC-Web, and Connect streaming. GrpcDispatcher::receive() returns either a UnaryCall or a ServerStreamingCall.

Define a server-streaming method in proto/echo.proto and build the descriptor set:

protobuf
syntax = "proto3";

package example.v1;

service Echo {
  rpc Echo(EchoMessage) returns (EchoMessage);
  rpc Watch(EchoMessage) returns (stream EchoMessage);
}

message EchoMessage {
  string text = 1;
}
sh
buf build proto --as-file-descriptor-set -o api.binpb

Handle unary and server-streaming calls in grpc.php by passing a \Generator to ServerStreamingCall::respond():

php
<?php

use Rapira\Exception\ClosedException;
use Rapira\Exception\WorkDiscardedException;
use Rapira\Grpc\ServerStreamingCall;
use Rapira\Grpc\UnaryCall;

$dispatcher = Rapira\get_dispatcher();

try {
    while (true) {
        $call = $dispatcher->receive();

        try {
            if ($call instanceof ServerStreamingCall) {
                $call->getResponseMetadata()->addHeader('x-stream', '1');
                $call->respond((static function (string $request): \Generator {
                    for ($i = 0; $i < 3; $i++) {
                        yield $request;
                    }
                })($call->getMessage()));
            } elseif ($call instanceof UnaryCall) {
                $call->respond($call->getMessage());
            }
        } catch (WorkDiscardedException) {
            continue;
        }
    }
} catch (ClosedException) {
    return;
}

You can load [grpc].descriptor_set from an http:// or https:// URL at startup. The auth interceptor checks bearer tokens with constant-time SHA-256 comparison:

toml
[grpc]
listen = "127.0.0.1:50051"
descriptor_set = "https://schemas.example.com/echo/v1/api.binpb"
reflection = true
interceptors = ["auth"]

[grpc.auth]
tokens_file = "grpc-tokens"

[grpc.pool]
entrypoint = "grpc.php"
mode = "dispatcher"
workers = 2

Test the streaming endpoint with grpcurl:

sh
grpcurl -plaintext -H 'authorization: Bearer ci.deploy-token' -d '{"text":"hello"}' 127.0.0.1:50051 example.v1.Echo/Watch

See Server-streaming calls, Load the descriptor set from a URL, and Authentication.

Packing applications with rapira pack and /app VFS # Major feature

rapira pack embeds your PHP application, rapira.toml, and an optional php.ini into a 64-bit Linux ELF or macOS Mach-O rapira executable.

Pack an application directory, then run the output binary directly from memory:

bash
rapira pack . -o dist/my-app --php-ini php.ini
./dist/my-app

Combine a static Linux binary with --base to create one self-contained executable with PHP and your application embedded:

bash
rapira pack . -o dist/my-app --base ./rapira-v0.10.0-php8.6-linux-x86_64-static/bin/rapira
./dist/my-app

In-memory /app VFS requires PHP 8.5 or newer

On PHP 8.5 and PHP 8.6, the packed executable mounts your files read-only in memory at /app without extracting files. It supports PHP streams, stat, glob, SplFileInfo, SplFileObject, opcache.preload, open_basedir, static files, and Exchange::sendFile().

On PHP 8.4, or when an application needs files on disk, extract the bundle once with --extract-dir or RAPIRA_EXTRACT_DIR:

bash
./dist/my-app --extract-dir /var/cache/my-app

See Packing an application, In-memory /app VFS, and Extract to disk.

Single-process ZTS runtime and pool controls # Major feature

v0.10 adds pool environment variables, CPU execution clocks, boot failure backoff, live object inspection, and coordinated OPcache reloads.

Configure pool environment variables, CPU time measurement, and boot limits in rapira.toml:

toml
[server]
pidfile = "/run/rapira.pid"
stop_timeout_secs = 30

[http]
listen = "127.0.0.1:8000"

[http.pool]
entrypoint = "public/index.php"
mode = "worker"
workers = 4
execution_clock = "cpu"
max_boot_failures = 5
request_terminate_timeout_secs = 30

[http.pool.env]
APP_ENV = "prod"
APP_DEBUG = "0"

Inspect live PHP objects in Worker or Dispatcher mode without adding strong references:

php
$counts = \Rapira\count_objects();
\Rapira\log('live objects', \Rapira\LogLevel::Info, [
    'orders' => $counts[App\Order::class] ?? 0,
]);

$instances = \Rapira\get_objects([App\Order::class]);
foreach ($instances as $order => $_) {
    // Inspect each retained object weakly.
}

On Linux and macOS, switch a symlinked deployment release and reload every pool with coordinated OPcache resets:

bash
ln -sfn /srv/releases/2026-12-03 /srv/current
kill -HUP "$(cat /run/rapira.pid)"

See Process model, The [http.pool] table, and Exit codes.

HTTP compression middleware and I/O performance #

HTTP connections run on dedicated single-threaded LocalSet I/O shards with streaming multipart parsing and zero-copy raw body chunks.

Enable built-in zstd and gzip response compression with "compress" in http.middleware:

toml
[http]
listen = "127.0.0.1:8000"
middleware = ["compress", "static"]

[http.compress]
min_size = 1024
gzip_level = 4
zstd_level = 3

[http.static]
root = "public"
forbid = [".php"]

Put "compress" before "static" in http.middleware to compress both static files and PHP responses.

Verify compression with curl:

bash
curl -i -H 'Accept-Encoding: zstd, gzip' http://127.0.0.1:8000/app.js
powershell
curl.exe -i -H "Accept-Encoding: zstd, gzip" http://127.0.0.1:8000/app.js

The static middleware shares its file cache across the server process and detects atomic renames by file identity. It also confines symbolic links inside the configured static root on both disk and /app VFS.

See The [http.compress] table, HTTP requests and responses, and Static files.

Static Linux binaries, Distroless images, and PHP 8.6 #

v0.10 adds PHP 8.6 builds and static single-binary Linux tarballs (-static.tar.gz for PHP 8.5 and 8.6). It also ships non-root Distroless container images on gcr.io/distroless/cc-debian13:nonroot. Container images rebuild automatically when the official PHP or Distroless base images update.

Download and verify a static Linux binary:

bash
curl -LO https://github.com/rapira-rs/rapira/releases/download/v0.10.0/rapira-v0.10.0-php8.6-linux-x86_64-static.tar.gz
curl -LO https://github.com/rapira-rs/rapira/releases/download/v0.10.0/rapira-v0.10.0-SHA256SUMS.txt
sha256sum -c --ignore-missing rapira-v0.10.0-SHA256SUMS.txt
tar xzf rapira-v0.10.0-php8.6-linux-x86_64-static.tar.gz
./rapira-v0.10.0-php8.6-linux-x86_64-static/bin/rapira --version

Run an application in a read-only Distroless container:

dockerfile
FROM ghcr.io/rapira-rs/rapira:php8.6 AS builder
WORKDIR /src
COPY . /src
RUN rapira pack /src -o /usr/local/bin/my-app

FROM ghcr.io/rapira-rs/rapira:php8.6-distroless
COPY --from=builder /usr/local/bin/my-app /usr/local/bin/my-app
ENTRYPOINT ["/usr/local/bin/my-app"]
CMD []
bash
docker build -t my-app .
docker run --init --read-only --tmpfs /tmp:rw,mode=1777 -p 8000:8000 my-app

See Static Linux binaries, Distroless, and Download.

Earlier releases #

  • v0.9.2 (2026-11-01): App recycling at max_requests and on reload, HttpDispatcherInfo::serverName() and serverPort(), HTTP/gRPC drain fixes, and the Sodium extension. Read the Rapira 0.9.2 post.
  • v0.9.1 (2026-10-07): Fixed isCancelled() and isFinalized() crashes in x86-64 release builds and HTTP/1.1 Transfer-Encoding and Connection header handling.
  • v0.9.0 (2026-10-05): Independent HTTP and gRPC worker pools, unary gRPC/gRPC-Web/Connect plugin with bearer-token auth, Prometheus /metrics, /livez and /readyz probes, and bundled PHP extensions.
  • v0.8.1 (2026-09-05): Improved HTTP connection distribution across workers on Linux.
  • v0.8.0 (2026-09-02): Hyper and Tower HTTP/1.1 server, \Rapira\Mode runtime API, and static file serving with an in-memory cache.