Skip to content

fix: WP-CLI fails with FrankenPHP 1.13.0; validate same-distribution CLI compatibility #46

Open

Description

@oscarhugopaz

P0: WordPress/WP-CLI runtime compatibility

Reported environment: Windows WSL2, Ubuntu 26.04, user peter_23, Homebrew Plak 0.4.65, /usr/bin/frankenphp package 1.13.0+php85-1, PHP 8.5, Caddy 2.11.7, /usr/local/bin/wp. Investigated on Ubuntu 24.04 ARM64 not WSL with official static 1.12.7/1.13.0 (same PHP 8.5.11), WP-CLI 2.12.0, plus isolated extracted DEB FrankenPHP 1.13.0 and php-zts-cli/embed 8.5.11-2 (no packages installed).

Reproduction / actual behavior

Create argv.php printing $argv, $argc, $_SERVER['argv'], $_SERVER['argc']. Run frankenphp php-cli argv.php alpha beta. 1.13.0 returns [frankenphp, script, alpha, beta] / argc 4; 1.12.7 and native php-zts return [script, alpha, beta] / argc 3. Both static and DEB 1.13.0 reproduce the shift. Independently run frankenphp php-cli /usr/local/bin/wp cli info: exit 1, Error: '/usr/local/bin/wp' is not a registered wp command. Plain PHP scripts and PHARs are affected; not a WSL-specific failure.

Expected: normal arguments and working WordPress creation/administration without an unrelated second PHP installation. Static HTML creation is not implicated.

Confirmed cause / compatibility findings

  • Upstream known regression php-cli (v1.13.0): $argv[0] is "frankenphp" and the script path is shifted to $argv[1] — breaks Symfony Console php/frankenphp#2690; fix fix #2690 php/frankenphp#2691 merged 2026-10-10, no newer published release as of 2026-10-12 (latest 1.13.0).
  • 1.13.0 caddy/php-cli.go prepends binary argv; PHP <8.6 emulation in emulate_php_cli.c passes that unshifted vector into php_embed_init. Upstream patch shifts script/eval arguments.
  • The lower than 8.6 message is emitted when the emulation finds neither a script nor -r code (unsupported modes such as bare -i/-v); it is not evidence that WP-CLI requires 8.6.
  • -f script -- ... and -- do not fix 1.13.0 argument placement (reproduced).
  • PHAR WP-CLI subprocesses use PHP_BINARY directly. An argv-only eval shim would leave launch_self() broken because the emulation also reports the wrong PHP_BINARY; reject a core-download-only workaround.

Selected correction / alternatives

Preserve direct FrankenPHP execution on working runtimes. For the affected 1.13.0, probe actual script argv first (allow downstream backports); if broken, select only the readable executable sibling php-zts from the same distribution after checking exact PHP version, ZTS, architecture, loaded/scanned INI, relevant configuration and extension parity, plus conventional argv. Do not select generic php, install a new runtime, downgrade/upgrade packages, or silently accept mismatches. With no compatible companion, fail before provisioning with actionable upstream/companion guidance. Upgrade to a tested released upstream fix when one exists; do not target unreleased PHP8.6 based on strings.

Route all shell and embedded PHP WP invocations through the shared argv-array resolver: add/wp/core, provisioning, login, plugin/theme/agent, multisite, snapshot/clone/migration and the DB/history child-process paths.

Acceptance / tests

  • Minimal scripts and WP-CLI info work with selected runtime; args (spaces/empty/metacharacters), stdin/stdout/stderr and exit codes preserved.
  • 1.13.0 + matching same-distribution php-zts restores WordPress download/install/administration and WP-CLI self-subprocesses.
  • Mismatch/missing companion blocks safely before new site/DB resources; corrected runtime stays direct.
  • DB/history do not bypass selection; deterministic regression fixtures cover all branches.
  • Real isolated WordPress/MariaDB tests pass and failed provisioning rollback is retained.
  • No system packages, production runtime or existing user sites modified. Real WSL2 manual acceptance remains required.

Affected: shared/site/wp-cli, commands/site/add, commands/site/wp, commands/site/db, commands/site/history, shared/site/history, shared/site/multisite, shared/site/agent, generated plak.sh, tests/wp-cli.sh, live tests. Depends on FrankenPHP/PHP, WP-CLI, mysqli/MariaDB and correct PHPRC; diagnostics and Windows trust are separate follow-ups.

Activity

  1. linear commented on Oct 12, 2026

    @linear
  2. oscarhugopaz commented on Oct 12, 2026

    @oscarhugopaz
    ContributorAuthor

    Related: #47 (provisioning errors/readiness) and #48 (WSL hostname/Windows trust). Compatibility and upstream-version investigation share this confirmed root cause, so they are tracked together rather than duplicated.

  3. oscarhugopaz commented on Oct 12, 2026

    @oscarhugopaz
    ContributorAuthor

    Implemented in #49. Verified on isolated Linux ARM64: static and DEB1.13.0 argument regression; 1.12.7 with same PHP8.5.11 does not shift; validated extracted php-zts-cli/embed8.5.11-2 fallback passed WP info and real disposable WordPress/MariaDB multisite provisioning, login, clone/rename, DB list, history save/restore and launch_self. Full smoke/argv/streams/status tests pass. No packages installed and no existing user resources touched. WSL2 host acceptance remains outstanding; no upgrade/release performed.

  4. self-assigned this
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions