Problem
#585 / phpc_deploy_path() rewrite __DIR__ includes at AOT link time for bundled sources. #609 copies templates/ into dist/, but MiniWebApp still uses runtime include __DIR__ . '/../templates/layout.php' from Router methods.
Native binaries must resolve those includes against PHPC_DEPLOY_ROOT at request time (same as VM DeployRoot::resolve()), not only compile-time literal paths.
Today lib/AOT/ has no TYPE_INCLUDE lowering; template includes may break after phpc build --project even when #568 object model lands.
Goal
export PHPC_DEPLOY_ROOT=/var/www/miniwebapp-dist
./bin/app # CGI env → home route renders layout.php from dist/templates/
VM + AOT: TYPE_INCLUDE with phpc_deploy_path() operand calls DeployRoot::resolve() or reads pre-copied trees under deploy root.
Implementation hints
| Area |
Files |
Notes |
| VM |
lib/VM.php TYPE_INCLUDE |
Already resolves paths; ensure phpc_deploy_path() builtin matches deploy root |
| AOT |
lib/AOT/, lib/JIT/IncludeHelper.php |
Emit runtime include stub or callback into VM include path |
| Bundler |
lib/Web/SourceBundler.php |
Only rewrite includes marked for deploy; keep templates/ as runtime copies |
| Tests |
test/fixtures/aot/cases/deploy_include_template.phpt |
temp dist + PHPC_DEPLOY_ROOT |
| E2E |
#612 |
dist-layout smoke after deploy + include works |
Acceptance criteria
docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
./script/ci-local.sh --filter deploy_include
Fixture passes VM today; AOT case unskipped when #568 links MiniWebApp (or minimal class + include fixture first).
Dependencies
Verification
Local/Docker only — not GitHub Actions.
Links
Problem
#585 /
phpc_deploy_path()rewrite__DIR__includes at AOT link time for bundled sources. #609 copiestemplates/into dist/, but MiniWebApp still uses runtimeinclude __DIR__ . '/../templates/layout.php'fromRoutermethods.Native binaries must resolve those includes against
PHPC_DEPLOY_ROOTat request time (same as VMDeployRoot::resolve()), not only compile-time literal paths.Today
lib/AOT/has noTYPE_INCLUDElowering; template includes may break afterphpc build --projecteven when #568 object model lands.Goal
VM + AOT:
TYPE_INCLUDEwithphpc_deploy_path()operand callsDeployRoot::resolve()or reads pre-copied trees under deploy root.Implementation hints
lib/VM.phpTYPE_INCLUDEphpc_deploy_path()builtin matches deploy rootlib/AOT/,lib/JIT/IncludeHelper.phplib/Web/SourceBundler.phptemplates/as runtime copiestest/fixtures/aot/cases/deploy_include_template.phptPHPC_DEPLOY_ROOTAcceptance criteria
docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \ ./script/ci-local.sh --filter deploy_includeFixture passes VM today; AOT case unskipped when #568 links MiniWebApp (or minimal class + include fixture first).
Dependencies
PHPC_DEPLOY_ROOT/phpc_deploy_path()(closed)phpc deploycopiestemplates/(CLI landed; see issue comment)Verification
Local/Docker only — not GitHub Actions.
Links
lib/Web/DeployRoot.php,ext/standard/phpc_deploy_path.phpexamples/003-MiniWebApp/templates/