-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Overview
Our current base images writes PHP configuration files (application.ini and opcache.ini) at build time, embedding values from environment variables such as:
- PHP_MEMORY_LIMIT
- PHP_MAX_EXECUTION_TIME
- PHP_UPLOAD_MAX_FILESIZE
- OPCACHE_ENABLED
- OPCACHE_MEMORY_CONSUMPTION
etc.
Because the .ini files are generated during image build, changing these variables at runtime (through docker run -e, docker-compose.yml, Kubernetes env: blocks, etc.) has no effect on the running container.
Problem
Users expect to be able to configure PHP behaviour dynamically at runtime, e.g.:
environment:
OPCACHE_ENABLED: "0"
PHP_MEMORY_LIMIT: "1024M"However, since the .ini files are baked into the image, PHP keeps using the build-time values, which makes the configuration inflexible and inconsistent with common container best practices.
Proposal
Refactor the way PHP configuration is generated:
- Remove build-time generation of:
--/usr/local/etc/php/conf.d/application.ini
--/usr/local/etc/php/conf.d/opcache.ini - Introduce a runtime entrypoint wrapper (e.g.
docker-php-entrypoint-env.sh) that:
-- reads current environment variables
-- dynamically generates the above .ini files on container start
-- finally delegates to the officialdocker-php-entrypoint - Ensure all default values remain compatible with existing behaviour, but allow full override via environment variables.
Acceptance criteria
- The image regenerates
application.iniandopcache.iniat container startup, not at build time - Changing environment variables in
docker runordocker-compose.ymlupdates PHP configuration as expected - The new entrypoint wrapper correctly forwards all arguments to the original entrypoint
- Documentation is updated to reflect the new behaviour
Metadata
Metadata
Assignees
Labels
No labels