Skip to content

Docs: Production deployment guide (nginx + AOT binary + CGI/FastCGI) #445

@PurHur

Description

@PurHur

Problem

README documents dev workflows (phpc serve, phpc serve --aot) but not a single production narrative from phpc build → live site behind nginx.

Pieces exist across closed issues:

Contributors still grep #50, #180, #443 for the full story.

Goal

Umbrella production deployment guide (extend docs/deploy-web-aot.md or add docs/deploy-production.md) covering:

  1. Build + deployphpc build --project, phpc deploy, dist layout (#609, #635)
  2. Static assets — nginx alias for assets/ / public/ (#696)
  3. CGI — per-request env (QUERY_STRING, REQUEST_METHOD, PATH_INFO, …) — Web: Runtime-populated superglobals for JIT and AOT (per-request $_GET/$_POST) #49, Web: AOT CGI wrapper for phpc-built binaries (production nginx spawn) #665
  4. FastCGI — nginx fastcgi_pass pool — Web: FastCGI request loop adapter (nginx / php-fpm compatible) #173 (when implemented)
  5. TLS termination — reverse proxy in front of CGI (illustrative only)
  6. Security — body limits Security: Request body size limits and header sanitization in CGI driver #77, PHP_COMPILER_DEBUG, path traversal, contact validation Security: MiniWebApp contact POST validation and body limits (dev + deploy) #697
  7. Local smoke before deploymake examples-web-smoke, phpc cgi on dist, optional --aot (Testing: ServeAotTest MiniWebApp routes via phpc serve --aot (blocked #764 execute) #478, Testing: CgiDriverTest MiniWebApp PATH_INFO via AOT cgi-wrapper (blocked #764) #682)

Implementation hints

Section Source issues Files
Quickstart (done) #635 docs/deploy-web-aot.md
nginx CGI #665, #50 bin/cgi-aot.php, docs/deploy-web-aot.md
Static files #696 examples/003-MiniWebApp/assets/
FastCGI #173 new lib/Web/FastCgi*.php TBD
MiniWebApp AOT #568, #445 blocked until native link
Checklist #472, #657 phpc doctor --gates

Suggested doc outline

  1. Prerequisites (LLVM, Docker image php-compiler:22.04-dev)
  2. Build/deploy commands (002 green, 003 blocked note)
  3. Dist tree diagram (bin/app, cgi-wrapper, assets/, templates/)
  4. nginx server block (CGI + static locations)
  5. FastCGI appendix (stub until Web: FastCGI request loop adapter (nginx / php-fpm compatible) #173)
  6. Operations (env vars, logs, upgrading binary)
  7. Verification commands (local only)

Acceptance criteria

Verification (review)

./phpc deploy examples/002-StaticWeb -o /tmp/static-dist
phpc cgi /tmp/static-dist/bin/app
make examples-web-smoke

Optional: script/check-doc-links.sh if link checker exists.

Dependencies

Non-goals

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolingTooling / CI / docsarea:webWeb / CGI / superglobalsenhancementNew feature or requestphase-3:aotPhase 3 – AOT deployment

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions