# Parallax PHP Source Kit A redistributable Python 3.10+ command-line tool for preparing a PHP 8.5 source update from a `php -m` inventory. It captures the existing CLI installation, creates a reviewable build plan, applies hash-pinned local patches, builds PHP and its external extensions into a fresh prefix, and verifies the resulting CLI module inventory. It uses only the Python standard library. The tool supports Ubuntu 24.04. Build and activation are separate explicit operations. It keeps the existing PPA packages and PHP alternatives intact, builds into an isolated prefix, and can activate the temporary FPM through one managed systemd drop-in. It can restore the package runtime once the configured APT repositories offer a fixed replacement. It does not enroll repositories, connect over SSH, or resolve findings by itself. The managed helper below lets Klaxon execute the same source/PPA lifecycle through its authorized ZhQL runtime. ## Run the ZhQL workflow Use the Parallax CLI's `klaxon` executable with the installed Klaxon application. Install the command on PATH once from a CLI checkout: ```sh mkdir -p "$HOME/.local/bin" ln -sfn /absolute/path/to/parallax-cli/klaxon "$HOME/.local/bin/klaxon" export PATH="$HOME/.local/bin:$PATH" export KLAXON_APP_PATH=/absolute/path/to/klaxon klaxon probe web01.coolframes.com for CVE-2026-109618 and CVE-2026-109619, fix, report back, store as kit --team=1 ``` Keep the PATH line in your shell profile. If the CLI is installed as a Composer dependency, its `vendor/bin/klaxon` bin link can be added to PATH instead. A sibling `../klaxon` application is discovered automatically. The command runs Klaxon's existing compiler, team authorization, private report and kit storage. `fix` authorizes execution of the configured recipe. The standalone zipapp provides the lower-level source commands; running a `workflow.json` from the archive requires the CLI and Klaxon application. The target's private `strategy: "source_bridge"` profile selects the managed helper. For a verified older PHP 8.5 FPM runtime, it builds the approved locked source plan, verifies module/version parity, activates the candidate and probes the actual running service. An ambiguous vendor backport remains inconclusive in the initial assessment; an independently approved fixed source plan can replace that runtime without inventing vulnerability evidence for it. Repeat the same sentence, or replay its saved kit, to check the PPA again. When source mode is active, `fix` refreshes repository metadata. If no suitable candidate exists, the report records `source_retained` and verifies the current source runtime. Once a PHP 8.5 package at least as new as the approved source release is available, it attempts `ppa_return` and verifies the packaged runtime. A failed return retains or restores the source fallback. There is no background polling; run the sentence again when you want another check. ### Install the managed-host helper Use the extracted source archive on the Ubuntu 24.04 target. Install the build dependencies listed below separately. The host needs systemd with cgroup v2, apt/dpkg and a package-managed `php8.5-fpm.service`. The recipe controls FPM; application tests and persistent CLI worker restarts remain operator steps. Create a dedicated locked, non-login build account. It must have no other jobs or running processes. The SSH maintenance account is a separate account. ```sh sudo useradd --system --no-create-home --shell /usr/sbin/nologin parallax-php-build sudo passwd --lock parallax-php-build sudo install -d -o root -g root -m 0755 \ /usr/local/lib/parallax/php-source-kit /usr/local/libexec /etc/parallax sudo install -o root -g root -m 0644 \ klaxon_php_source.py klaxon_php_bridge.py parallax_php_workflow.py \ /usr/local/lib/parallax/php-source-kit/ sudo install -o root -g root -m 0755 \ deploy/parallax-php-workflow /usr/local/libexec/parallax-php-workflow ``` If the build account already exists, verify its locked password, non-login shell and exclusive use instead of recreating it. All installed helper files and their ancestors must remain root-owned and unwritable by other accounts. Prepare the plan as an ordinary operator, using the captured inventory or the supplied inventory after checking it against the actual FPM extensions. The managed helper requires these exact directory relationships: ```sh python3 klaxon_php_source.py plan \ --modules examples/slipstream-php-m.txt \ --version 8.5.12 --fpm \ --prefix /opt/parallax/php-source/8.5.12-source1/runtime \ --work-dir /opt/parallax/php-source/8.5.12-source1/build \ --extensions-lock examples/extensions.lock.json \ --output ./php-source-plan.json python3 klaxon_php_source.py build --plan ./php-source-plan.json --user-install sudo install -o root -g root -m 0644 \ ./php-source-plan.json /etc/parallax/php-source-plan.json sha256sum /etc/parallax/php-source-plan.json ``` The build command above previews operations. Do not create the session directory in advance: the helper reserves a fresh private session when it starts. Extra patches must be root-owned, hash-pinned and readable by the build account at the absolute paths in the plan. The plan is world-readable because it contains only build metadata, not credentials; keep its ancestors root-owned mode 0755. Copy `examples/php-workflow.example.json` to an operator-controlled working file, set `source_plan_sha256` to the actual digest printed above, and set `packages` to **every installed `php8.5-*` package** on this host, including extension packages. Enumerate them with: ```sh dpkg-query -W -f='${binary:Package}\t${db:Status-Status}\n' 'php8.5-*' | awk '$2 == "installed" {sub(/:.*/, "", $1); print $1}' | sort ``` The profile accepts up to 64 unique branch packages. Its example package list is illustrative; a subset of the installed branch is rejected before building. The plan, session, account, original binary, unit, FPM configuration and state paths must match the private application profile. The source helper reuses `/etc/php/8.5/fpm/php-fpm.conf` and its pools, while the source runtime has its own generated `php.ini` and extension scan directory. Review required runtime settings and application behavior before enabling the source recipe; module parity alone does not reconstruct production PHP settings. ```sh sudo install -o root -g root -m 0600 \ ./php-workflow.json /etc/parallax/php-workflow.json sudo visudo -f /etc/sudoers.d/parallax-php-workflow ``` Use `deploy/parallax-php-workflow.sudoers.example` for the dedicated `klaxon` SSH account. Grant only the fixed helper's `probe` and `fix` commands. Its wrapper imports the installed root-owned modules at a fixed path. The caller sends a profile digest on stdin; the root helper reads the fixed private profile and rejects a mismatch. No source path, URL, shell, account or privilege setting comes from the ZhQL sentence. The build runs as `parallax-php-build` in a transient systemd unit with a private session and restricted writes. It uses `--user-install` without sudo. The root helper stops the unit, checks that no build-account processes remain, seals the candidate prefix as root and calls the shared FPM bridge. It preserves package binaries, CLI alternatives and the original service/package baseline. ### Configure Klaxon and execute On the Klaxon application server, copy `examples/execution-source-targets.example.json` from the Klaxon checkout to an operator-owned private target file. Set the actual team IDs, SSH account, identity file and independently verified known-hosts file. The hostname must match the ZhQL target exactly. Synchronize its source fields, exact package scope and plan digest with `/etc/parallax/php-workflow.json` on the target. The example SHA placeholder must be replaced on both hosts. ```dotenv KLAXON_EXECUTION_TARGETS_FILE=/etc/klaxon/execution-targets.json ``` Deploy Klaxon's workflow migrations and use a shared cache backend for locks, as described in its `docs/EXECUTION.md`. Run the CLI for source builds; the configured source operation budget defaults to 8,400 seconds, and the build unit has a 7,200-second limit. Web execution requires suitable request timeouts. Run the ZhQL sentence shown above. Successful compilation or an apt exit code alone cannot complete it: the executor must verify the running FPM image and each requested known CVE, then returns the report and stores the declarative kit. The kit retains intent rather than SSH settings or past success. Replays revalidate the current private profile and runtime. Keep the bridge state and source prefix through PPA return and application validation. Completed or failed build sessions are immutable; use a newly reviewed plan and fresh session for another source build rather than deleting saved evidence. ## Export from Parallax CLI From the Parallax CLI project root: ```sh python3 scripts/package-php-source-kit.py \ --output-dir /absolute/path/to/new-export ``` An optional canonical Klaxon recipe and validated source plan can travel with the distribution: ```sh python3 scripts/package-php-source-kit.py \ --output-dir /absolute/path/to/new-export \ --workflow /absolute/path/to/workflow.json \ --plan /absolute/path/to/plan.json ``` The exporter prints JSON with the version, absolute artifact paths, byte lengths, and SHA-256 hashes. The output directory must be new or empty; existing files are preserved. Use a fresh output directory for each export. Artifacts: - `parallax-php-source-kit-VERSION.pyz`: standalone Python zipapp. - `parallax-php-source-kit-VERSION.tar.gz`: source, README, MIT license, example inventory, observed extension source lock, editable lock template, local tests, managed-helper deployment examples and tests, and a file manifest. - `SHA256SUMS`: artifact checksums. - `workflow.json` and `plan.json`, when supplied; also embedded in the archives. Both archives use normalized ordering and timestamps. The exporter includes only its fixed source-file allowlist and the explicitly supplied validated metadata. It does not bundle the application, vendor dependencies, environment files, SSH keys, runtime databases, or capture directories. Verify the export after transfer: ```sh sha256sum --check SHA256SUMS python3 parallax-php-source-kit-0.2.0.pyz --version python3 parallax-php-source-kit-0.2.0.pyz --help ``` The source archive is an equivalent option: ```sh tar -xzf parallax-php-source-kit-0.2.0.tar.gz cd parallax-php-source-kit-0.2.0 python3 klaxon_php_source.py --help python3 -m unittest discover -s tests -p test_php_source.py ``` A packaged workflow is declarative metadata, not a previously successful result or authorization to run on a target. It retains only schema, agent, normalized target hostname, CVEs, requested steps, and the existing `php-security-update-v1` recipe identifier. Exporting does not execute that workflow or add a new executable ZhQL dialect. ## Capture the existing installation Run as an ordinary user. Use an absolute PHP path so PATH changes do not select another interpreter: ```sh TOOL=/absolute/path/to/parallax-php-source-kit-0.2.0.pyz PHP_BIN="$(readlink -f "$(command -v php)")" AUDIT=/absolute/path/to/new-php-capture python3 "$TOOL" capture --php "$PHP_BIN" --output "$AUDIT" ``` The new directory contains: - `version.txt`, `modules.txt`, and `ini.txt`. - `build.json`: PHP version, build mode, SAPI, architecture, and extension versions. - `configure-options.txt` when the sibling matching `php-config` is available. - `ri-EXTENSION.txt` for loaded external extensions and selected bundled feature providers, with `.stderr` sidecars preserving warnings. - `manifest.json` with capture results. Review captured warnings. A module list cannot reconstruct codec support, serializer or compression settings, FPM pools, package backports, or every compile flag. CLI inventory is not proof of the running web service's version. The supplied `examples/slipstream-php-m.txt` reproduces the user's module list and can be used to prepare a plan without accessing a server. ## Prepare a plan Use a new installation prefix and a new build directory: ```sh python3 "$TOOL" plan \ --modules "$AUDIT/modules.txt" \ --version 8.5.12 \ --fpm \ --prefix /opt/php/8.5.12-klaxon1 \ --work-dir /home/forge/distro/8.5.12-klaxon1 \ --output ./php-source-plan.json ``` The --fpm switch includes the FPM build for a web server. Omitting it creates a CLI-only build. Neither mode creates or changes a system service. For the example inventory: ```sh python3 "$TOOL" plan \ --modules ./examples/slipstream-php-m.txt \ --fpm \ --prefix /opt/php/8.5.12-klaxon1 \ --work-dir /home/forge/distro/8.5.12-klaxon1 \ --output ./php-source-plan.json ``` PHP 8.5.12's official source URL and SHA-256 digest are pinned in the tool. For another supported PHP 8.5 patch release, supply its exact HTTPS source URL and verified SHA-256: ```sh python3 "$TOOL" plan \ --modules "$AUDIT/modules.txt" \ --version 8.5.REPLACE \ --fpm \ --source-url https://www.php.net/distributions/php-8.5.REPLACE.tar.xz \ --source-sha256 REPLACE_WITH_VERIFIED_64_HEX_SHA256 \ --prefix /opt/php/8.5.REPLACE-klaxon1 \ --work-dir /home/forge/distro/8.5.REPLACE-klaxon1 \ --output ./php-source-plan.json ``` That example intentionally needs real version and digest replacements. The supplied inventory needs seven external extensions: `igbinary`, `msgpack`, `redis`, `memcached`, `imagick`, `imap`, and `swoole`. Their source archives must be pinned before execution. `examples/extensions.lock.json` is a ready-to-use source lock: all seven exact archives were downloaded from the listed PECL HTTPS URLs on October 21, 2026, and their actual bytes were hashed. This records observed downloads; maintainer signatures were not independently verified and the extensions have not been compiled or integration-tested here. Review those versions against your captured installation and application before building. Use that observed lock for the supplied inventory, or customize the template. Copy `examples/extensions.lock.example.json` and replace every SHA-256 placeholder with an actual digest verified against the selected maintainer's release. The placeholders are deliberately invalid. Keep the installed extension versions where they support PHP 8.5, or choose and test a compatible release. A newly calculated hash records the downloaded bytes; validate their provenance before treating that hash as trusted. Prepare a new plan with the observed lock (or your reviewed custom lock): ```sh python3 "$TOOL" plan \ --modules "$AUDIT/modules.txt" \ --version 8.5.12 \ --fpm \ --prefix /opt/php/8.5.12-klaxon1 \ --work-dir /home/forge/distro/8.5.12-klaxon1 \ --extensions-lock ./examples/extensions.lock.json \ --output ./php-source-plan-locked.json ``` Lock format: ```json { "extensions": [ { "name": "igbinary", "version": "3.2.17RC1", "url": "https://pecl.php.net/get/igbinary-3.2.17RC1.tgz", "sha256": "REPLACE_WITH_VERIFIED_64_HEX_SHA256" } ] } ``` This short example covers one extension; the Slipstream inventory needs all seven. Unknown extensions or unresolved pins cannot be silently built. PHP 8.5 bundles URI, Lexbor, and OPcache. IMAP is external and must use NTS. The builder's supported configuration is a documented baseline; compare it with the captured features before replacing an existing installation. ## Apply an additional source patch Upgrading to the official PHP 8.5.12 source already includes that release's security fixes. An additional custom patch is optional. Prepare and review a local patch for the exact selected PHP version, record its verified digest, and add it when generating the plan: ```sh python3 "$TOOL" plan \ --modules "$AUDIT/modules.txt" \ --fpm \ --prefix /opt/php/8.5.12-klaxon2 \ --work-dir /home/forge/distro/8.5.12-klaxon2 \ --extensions-lock ./examples/extensions.lock.json \ --patch /absolute/path/to/reviewed-fix.patch:REPLACE_WITH_VERIFIED_64_HEX_SHA256 \ --output ./php-source-plan-patched.json ``` The patch bytes are verified again at build time. Keep the patch file available at the planned path; the exporter includes its plan metadata, not arbitrary local patch contents. A recipient must separately receive and verify required patch files. Copy them to the same absolute paths, or regenerate the plan on the destination with its actual patch, prefix and work-directory paths. Review the planned patch operations and build-configuration regeneration before executing. ## Install build dependencies on Ubuntu 24.04 Run the package installation separately with administrative privileges: ```sh sudo apt-get update sudo apt-get install -y \ build-essential autoconf automake libtool pkg-config bison re2c patch \ ca-certificates xz-utils \ libxml2-dev libsqlite3-dev libssl-dev libcurl4-openssl-dev \ libonig-dev libicu-dev libffi-dev libgmp-dev libreadline-dev \ libsodium-dev libxslt1-dev libzip-dev zlib1g-dev libpq-dev \ libpng-dev libjpeg-dev libfreetype-dev libwebp-dev libavif-dev \ libmagickwand-dev libmemcached-dev libsasl2-dev libbrotli-dev \ libc-client2007e-dev libkrb5-dev libsystemd-dev ``` The IMAP development package is in Ubuntu's `universe` repository. Install dependencies for the selected configuration; optional existing features can need additional libraries. ## Review and build The default build command only prints the derived operations: ```sh python3 "$TOOL" build --plan ./php-source-plan-locked.json ``` Review the JSON plan and printed commands. Then execute as an ordinary user: ```sh python3 "$TOOL" build --plan ./php-source-plan-locked.json --execute ``` Execution requires fresh work/prefix directories and resolved extension archives. The tool verifies download hashes, safely extracts sources, runs the PHP configure/build/tests/install sequence, and builds external extensions using the new prefix's own `phpize` and `php-config`. Serializer extensions are built before their consumers. The operator build uses `sudo` only for installation; compilation as root is refused. The managed helper uses `--user-install` within its private build-account-owned session and grants no sudo access to that account. Do not copy existing `.so` files into the new extension directory. Preserve application serializer settings when migrating configuration. Review test failures and feature differences before cutover. ## Verify and switch the running service Check the installed CLI binary explicitly: ```sh python3 "$TOOL" verify \ --plan ./php-source-plan-locked.json \ --php /opt/php/8.5.12-klaxon1/bin/php ``` Verification checks the planned PHP version and module inventory. Review extension versions and feature flags as well. A successful CLI check does not certify the web runtime or either CVE on a running service. Before any operator-managed cutover: 1. Identify the existing FPM service and its executable/configuration references. 2. Migrate runtime settings and pool configuration. Preserve users, sockets, permissions, environment and process-manager settings; remove obsolete extension loaders and old absolute extension paths. 3. Run the replacement FPM's configuration check and test it through a separate socket or staging route. 4. Test application database/cache/image/mail/Swoole behavior. 5. Change the service references and restart the service in the maintenance window. Restart persistent PHP workers using the replacement interpreter. 6. Verify actual running processes and application health. Keep the previous prefix and service configuration. Rollback restores those references and restarts affected processes; changing a symlink alone does not replace running worker processes. The explicit bridge commands below manage the FPM handoff and verify service processes. Application checks and persistent CLI workers remain operator steps. Klaxon's `source_bridge` strategy invokes the managed helper above and verifies the running service after each handoff. Its default package-only strategy still uses the existing bounded apt helper. Exporting a kit alone runs neither recipe. ## Temporary source mode and return to the PPA Parallax CLI exposes every command through `./slipstream php`. The zipapp uses identical arguments. Build the plan with `--fpm`, migrate the candidate runtime and pool configuration, and test the application before activating it. Keep PID paths, listeners, pool users and socket permissions equal to the packaged FPM service. The bridge refuses incompatible pool or PID changes. The example state file is root-owned mode 0600, so status and restore previews also use `sudo`. Preview activation without `--execute`: ```sh sudo python3 "$TOOL" activate \ --plan ./php-source-plan-locked.json \ --service php8.5-fpm.service \ --fpm-config /opt/php/8.5.12-klaxon1/etc/php-fpm.conf \ --state /var/lib/parallax/php-source-8.5.json ``` Repeat with `--execute` to save the original service/package baseline, install the dedicated temporary drop-in and restart onto the source binary. The bridge requires a fresh invocation and verifies cgroup process executables. A failed activation attempts to restore the packaged service and records the outcome. It never overwrites the package binaries or changes CLI alternatives. Refresh repository metadata and check whether a suitable candidate is available: ```sh sudo python3 "$TOOL" ppa-status \ --state /var/lib/parallax/php-source-8.5.json --refresh --execute ``` Only the existing configured APT repositories are consulted. The FPM candidate must stay on the PHP 8.5 branch and meet the source plan's fixed upstream version. A backport retaining an older upstream version needs manual review; it is not automatically accepted by this gate. Preview the return, then execute it: ```sh sudo python3 "$TOOL" return-to-ppa \ --state /var/lib/parallax/php-source-8.5.json sudo python3 "$TOOL" return-to-ppa \ --state /var/lib/parallax/php-source-8.5.json --execute ``` The return simulates and upgrades only the recorded installed `php8.5-*` packages. It retains the source override while checking the installed packaged FPM version, module inventory and configuration. It removes only its unchanged managed drop-in, restores the effective package service command, restarts and verifies the package executable in the running service. A failed handoff attempts to restore and verify the source runtime and records the rollback outcome. Keep the state and source prefix until application health is confirmed. No running-service or CVE success is inferred from compilation or an APT exit status alone. The tests for these operations use temporary files and mocked APT/systemd; a real maintenance window still requires host validation. ## Sources and license - [PHP source build instructions](https://github.com/php/php-src/blob/php-8.5.12/README.md) - [PHP source downloads and published digests](https://www.php.net/downloads.php?source=Y) - [PHP extension compilation with phpize](https://www.php.net/manual/en/install.pecl.phpize.php) - [Selecting a matching php-config](https://www.php.net/manual/en/install.pecl.php-config.php) - [PHP 8.5.12 security announcement](https://www.php.net/releases/8_5_12.php) - [IMAP installation and ZTS restriction](https://www.php.net/manual/en/imap.installation.php) MIT; see the included `LICENSE`. PHP and extension source archives retain their own licenses and are downloaded separately during the selected build.