Skip to content

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

Open
YK-03 wants to merge 1 commit into
oblien:mainfrom
YK-03:feat/1774-php-ini-configuration
Open

YK-03 wants to merge 1 commit into
oblien:mainfrom
YK-03:feat/1774-php-ini-configuration

Conversation

@YK-03

@YK-03 YK-03 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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).

The OpenShip edge proxy accepts request bodies up to 50 MB by default (`EDGE_CLIENT_MAX_BODY_SIZE`). 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`).

Write `upload_max_filesize = 50M` and `post_max_size = 50M` into `$PHP_INI_DIR/conf.d/zz-openship.ini` in the runtime stage before copying project files and dropping privileges to `USER www-data`. This ensures it runs as root, caches across rebuilds, and applies to web, worker, and release containers sharing the image.

Fixes oblien#1774

Signed-off-by: Yash Kaushik <yash005kaushik@gmail.com>
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.

[Feature]: Set php.ini values for generated PHP builds

1 participant