Skip to content

Web: $_SERVER['DOCUMENT_ROOT'] for docroot-relative paths (#296)#305

Merged
PurHur merged 1 commit into
masterfrom
feat/web-document-root-296
May 19, 2026
Merged

Web: $_SERVER['DOCUMENT_ROOT'] for docroot-relative paths (#296)#305
PurHur merged 1 commit into
masterfrom
feat/web-document-root-296

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 19, 2026

Summary

  • Populate $_SERVER['DOCUMENT_ROOT'] from the DOCUMENT_ROOT CGI environment variable in VM superglobals and AOT __superglobals__refresh.
  • Dev server (bin/serve.php / serve-aot) sets DOCUMENT_ROOT to the resolved docroot on every request.
  • Regression coverage: unit test, VM PHPT, AOT PHPT, ServeTest, ServeAotTest, and RuntimeSuperglobalRefreshTest.
  • Fix ServeAotTest::compileExample to merge LLVM env into baseEnv() so proc_open retains a usable PATH for php/env.

Closes #296.

Test plan

  • docker run … php vendor/bin/phpunit --filter DocumentRoot (unit, serve, AOT refresh)
  • bash script/ci-local.sh --filter DocumentRoot in php-compiler:22.04-dev (VM + serve + AOT refresh)
  • Full script/ci-local.sh on a host with loopback + LLVM (recommended before release)

Made with Cursor

Expose the serve docroot in VM and AOT superglobals so scripts can build
docroot-relative paths. DevServer sets DOCUMENT_ROOT per request; AOT
refresh copies it from the environment. Includes VM/AOT/serve regression
tests and fixes ServeAotTest compile env PATH merging.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 11392b2 into master May 19, 2026
1 check failed
@PurHur PurHur deleted the feat/web-document-root-296 branch May 19, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web: $_SERVER['DOCUMENT_ROOT'] for docroot-relative paths

1 participant