#1885

fix(php): align upload limits with edge default in generated runtime (#1774)

OpenYK-03wants to merge intofrom

Summary

Fixes #1774. The OpenShip edge proxy accepts request bodies up to 50 MB by default (EDGE_CLIENT_MAX_BODY_SIZE). However, FrankenPHP base images run without a php.ini, leaving PHP at its built-in defaults: upload_max_filesize = 2M and post_max_size = 8M. Uploads between 2 MB and 50 MB pass through the edge proxy but silently fail inside PHP (which cannot be raised via ini_set() since upload_max_filesize is PHP_INI_PERDIR).

Solution

Write upload_max_filesize = 50M and post_max_size = 50M into $PHP_INI_DIR/conf.d/zz-openship.ini in the runtime stage right after extension installation and before copying application code and dropping privileges to USER www-data.

  • Running this during the image assembly ensures it executes as root without requiring runtime file writes.
  • Placing it before copying application files ensures maximum Docker layer cache reuse across commits.
  • Writing to $PHP_INI_DIR/conf.d/zz-openship.ini takes advantage of PHP's automatic scan directory and ensures directives override any default values.
  • Applies uniformly to web, worker, and release containers sharing the runtime image.

Verification

  • Added unit test in packages/adapters/src/runtime/docker-build-plan.test.ts verifying that $PHP_INI_DIR/conf.d/zz-openship.ini is populated with upload_max_filesize = 50M and post_max_size = 50M in the runtime stage prior to copying app code.
  • Ran test suite npx vitest run src/runtime/docker-build-plan.test.ts (all 47 tests passed).