-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change common php settings via environment variable #765
Comments
You could go for the kitchen-sink solution and just map all environment variables with a specific prefix to their corresponding php.ini settings, such as a prefix like Something like that would be pretty sophisticated I think, and given my merge request for specifically just memory limit, it would be really nice to get that in first (since it's a quick stopgap at the very least) and then replace it later with a more flushed-out and generic system (assuming that's the direction you're trying to go) |
@yosifkit would you accept a PR implementing this? |
see also: TimWolla/docker-adminer#36 |
This is definitely not something I'm very keen on seeing explicitly implemented here in the |
Here's an example simple command/script which can be used to accomplish this pretty trivially (explicitly ignoring $ docker run ... -e PHP_INI_MEMORY_LIMIT=2G php:7.3-apache bash -exc 'for env in "${!PHP_INI_@}"; do [ "$env" != 'PHP_INI_DIR' ] || continue; val="${!env}"; var="${env#PHP_INI_}"; var="${var,,}"; echo "$var = $val"; done > "$PHP_INI_DIR/docker-env.ini"; exec apache2-foreground' Note this won't work very well for directives which contain Alternatively (and more supportably long-term IMO), take advantage of FROM php:7.3-apache
ENV PHP_INI_MEMORY_LIMIT 128M
RUN echo 'memory_limit = ${PHP_INI_MEMORY_LIMIT}' > "$PHP_INI_DIR/docker-env.ini" |
For future reference,
So you could also use the
|
There was a request to change memory_limit via environment variable:
nextcloud/docker#568
There are other settings that are frequently requested to change, like the upload limit.
Is it worth to allow some common settings to be set via environment variables?
https://secure.php.net/manual/en/configuration.file.php#example-36
The text was updated successfully, but these errors were encountered: