From 846f6cd2ad5722415c9d6beba66af9e9e4be2a69 Mon Sep 17 00:00:00 2001 From: Ander Gabilondo Date: Mon, 7 Sep 2026 09:57:53 +0200 Subject: [PATCH] Add PHP_FILE_UPLOADS and PHP_MAX_FILE_UPLOADS to environment variables --- docs/content/docs/2.image-variations/fpm-apache.md | 2 ++ docs/content/docs/2.image-variations/fpm-nginx.md | 2 ++ docs/content/docs/2.image-variations/frankenphp.md | 2 ++ .../docs/8.reference/1.environment-variable-specification.md | 2 ++ .../usr/local/etc/php/conf.d/serversideup-docker-php.ini | 4 ++-- src/variations/cli/Dockerfile | 2 ++ src/variations/fpm-apache/Dockerfile | 2 ++ src/variations/fpm-nginx/Dockerfile | 2 ++ src/variations/fpm/Dockerfile | 2 ++ src/variations/frankenphp/Dockerfile | 2 ++ 10 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/content/docs/2.image-variations/fpm-apache.md b/docs/content/docs/2.image-variations/fpm-apache.md index 194245e6c..58cab7791 100644 --- a/docs/content/docs/2.image-variations/fpm-apache.md +++ b/docs/content/docs/2.image-variations/fpm-apache.md @@ -235,6 +235,8 @@ For a complete list of available environment variables, see the [Environment Var | `PHP_MEMORY_LIMIT` | `256M` | Maximum memory a script can use | | `PHP_MAX_EXECUTION_TIME` | `99` | Maximum time a script can run (seconds) | | `PHP_UPLOAD_MAX_FILE_SIZE` | `100M` | Maximum upload file size | +| `PHP_FILE_UPLOADS` | `On` | Whether HTTP file uploads are allowed | +| `PHP_MAX_FILE_UPLOADS` | `20` | Maximum number of files per request | | `PHP_POST_MAX_SIZE` | `100M` | Maximum POST request size | ::tip{to="/docs/reference/environment-variable-specification"} diff --git a/docs/content/docs/2.image-variations/fpm-nginx.md b/docs/content/docs/2.image-variations/fpm-nginx.md index 077cb1390..7e635a734 100644 --- a/docs/content/docs/2.image-variations/fpm-nginx.md +++ b/docs/content/docs/2.image-variations/fpm-nginx.md @@ -236,6 +236,8 @@ For a complete list of available environment variables, see the [Environment Var | `PHP_MEMORY_LIMIT` | `256M` | Maximum memory a script can use | | `PHP_MAX_EXECUTION_TIME` | `99` | Maximum time a script can run (seconds) | | `PHP_UPLOAD_MAX_FILE_SIZE` | `100M` | Maximum upload file size | +| `PHP_FILE_UPLOADS` | `On` | Whether HTTP file uploads are allowed | +| `PHP_MAX_FILE_UPLOADS` | `20` | Maximum number of files per request | | `PHP_POST_MAX_SIZE` | `100M` | Maximum POST request size | ## Performance Tuning diff --git a/docs/content/docs/2.image-variations/frankenphp.md b/docs/content/docs/2.image-variations/frankenphp.md index 278d601c7..bd5604dbb 100644 --- a/docs/content/docs/2.image-variations/frankenphp.md +++ b/docs/content/docs/2.image-variations/frankenphp.md @@ -363,6 +363,8 @@ For a complete list of available environment variables, see the [Environment Var | `PHP_MEMORY_LIMIT` | `256M` | Maximum memory a script can use | | `PHP_MAX_EXECUTION_TIME` | `99` | Maximum time a script can run (seconds) | | `PHP_UPLOAD_MAX_FILE_SIZE` | `100M` | Maximum upload file size | +| `PHP_FILE_UPLOADS` | `On` | Whether HTTP file uploads are allowed | +| `PHP_MAX_FILE_UPLOADS` | `20` | Maximum number of files per request | | `PHP_POST_MAX_SIZE` | `100M` | Maximum POST request size | | `PHP_OPCACHE_ENABLE` | `0` | Enable OPcache (`0`/`1`) | | `PHP_OPCACHE_REVALIDATE_FREQ` | `2` | How often to check for file changes (seconds) | diff --git a/docs/content/docs/8.reference/1.environment-variable-specification.md b/docs/content/docs/8.reference/1.environment-variable-specification.md index 0b6d28f4d..5d90966b9 100644 --- a/docs/content/docs/8.reference/1.environment-variable-specification.md +++ b/docs/content/docs/8.reference/1.environment-variable-specification.md @@ -79,6 +79,7 @@ Setting environment variables all depends on what method you're using to run you `PHP_DISPLAY_STARTUP_ERRORS`
*Default: Off*|Even when display_errors is on, errors that occur during PHP's startup sequence are not displayed. (Official docs)| all `PHP_ERROR_LOG`
*Default: "/dev/stderr"*|Name of the file where script errors should be logged. . (Official docs)|all `PHP_ERROR_REPORTING`
*Default: "22527"*|Set PHP error reporting level. Must be a number. Use this tool for help. (Official docs)|all +`PHP_FILE_UPLOADS`
*Default: "On"*|Whether to allow HTTP file uploads. (Official docs)|all `PHP_FPM_CHILD_PROCESS_USER`
*Default: "www-data"*| ⚠️ Only used if container is running as root. Set the user of the PHP-FPM child processes. (Official docs)|fpm* `PHP_FPM_CHILD_PROCESS_GROUP`
*Default: "www-data"*| ⚠️ Only used if container is running as root. Set the group of the PHP-FPM child processes. (Official docs)|fpm* `PHP_FPM_PM_CONTROL`
*Defaults:
fpm: dynamic
fpm-apache: ondemand
fpm-nginx: ondemand*|Choose how the process manager will control the number of child processes. (Official docs)|fpm* @@ -91,6 +92,7 @@ Setting environment variables all depends on what method you're using to run you `PHP_FPM_POOL_NAME`
*Default: "www"*|Set the name of your PHP-FPM pool (helpful when running multiple sites on a single server).|fpm* `PHP_FPM_PROCESS_CONTROL_TIMEOUT`
*Default: "10s"*|Set the timeout for the process control commands. (Official docs)|fpm* `PHP_MAX_EXECUTION_TIME`
*Default: "99"*|Set the maximum time in seconds a script is allowed to run before it is terminated by the parser. (Official docs)|all +`PHP_MAX_FILE_UPLOADS`
*Default: "20"*|The maximum number of files allowed to be uploaded in a single request. (Official docs)|all `PHP_MAX_INPUT_TIME`
*Default: "-1"*|This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET. Timing begins at the moment PHP is invoked at the server and ends when execution begins. The default setting is -1, which means that max_execution_time is used instead. Set to 0 to allow unlimited time. This directive is hardcoded to -1 for the CLI SAPI by PHP. (Official docs)|all `PHP_MAX_INPUT_VARS`
*Default: "1000"*|Set the limits for number of input variables (e.g., POST, GET, or COOKIE variables) that PHP will process in a single request. (Official docs)|all `PHP_MEMORY_LIMIT`
*Default: "256M"*|Set the maximum amount of memory in bytes that a script is allowed to allocate. (Official docs)|all diff --git a/src/common/usr/local/etc/php/conf.d/serversideup-docker-php.ini b/src/common/usr/local/etc/php/conf.d/serversideup-docker-php.ini index 0bbeec28c..36c103def 100644 --- a/src/common/usr/local/etc/php/conf.d/serversideup-docker-php.ini +++ b/src/common/usr/local/etc/php/conf.d/serversideup-docker-php.ini @@ -849,7 +849,7 @@ enable_dl = Off ; Whether to allow HTTP file uploads. ; https://php.net/file-uploads -file_uploads = On +file_uploads = ${PHP_FILE_UPLOADS} ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). @@ -861,7 +861,7 @@ file_uploads = On upload_max_filesize = ${PHP_UPLOAD_MAX_FILE_SIZE} ; Maximum number of files that can be uploaded via a single request -max_file_uploads = 20 +max_file_uploads = ${PHP_MAX_FILE_UPLOADS} ;;;;;;;;;;;;;;;;;; ; Fopen wrappers ; diff --git a/src/variations/cli/Dockerfile b/src/variations/cli/Dockerfile index 9e64137f5..faadcfff6 100644 --- a/src/variations/cli/Dockerfile +++ b/src/variations/cli/Dockerfile @@ -33,7 +33,9 @@ ENV APP_BASE_DIR=/var/www/html \ PHP_DISPLAY_STARTUP_ERRORS=Off \ PHP_ERROR_LOG="/dev/stderr" \ PHP_ERROR_REPORTING="22527" \ + PHP_FILE_UPLOADS="On" \ PHP_MAX_EXECUTION_TIME="99" \ + PHP_MAX_FILE_UPLOADS="20" \ PHP_MAX_INPUT_TIME="-1" \ PHP_MAX_INPUT_VARS="1000" \ PHP_MEMORY_LIMIT="256M" \ diff --git a/src/variations/fpm-apache/Dockerfile b/src/variations/fpm-apache/Dockerfile index 3d4e52f55..b47e6df22 100644 --- a/src/variations/fpm-apache/Dockerfile +++ b/src/variations/fpm-apache/Dockerfile @@ -61,6 +61,7 @@ ENV APACHE_DOCUMENT_ROOT=/var/www/html/public \ PHP_DISPLAY_STARTUP_ERRORS=Off \ PHP_ERROR_LOG="/dev/stderr" \ PHP_ERROR_REPORTING="22527" \ + PHP_FILE_UPLOADS="On" \ PHP_FPM_PM_CONTROL=ondemand \ PHP_FPM_PM_MAX_CHILDREN="20" \ PHP_FPM_PM_MAX_REQUESTS="0" \ @@ -71,6 +72,7 @@ ENV APACHE_DOCUMENT_ROOT=/var/www/html/public \ PHP_FPM_POOL_NAME="www" \ PHP_FPM_PROCESS_CONTROL_TIMEOUT="10s" \ PHP_MAX_EXECUTION_TIME="99" \ + PHP_MAX_FILE_UPLOADS="20" \ PHP_MAX_INPUT_TIME="-1" \ PHP_MAX_INPUT_VARS="1000" \ PHP_MEMORY_LIMIT="256M" \ diff --git a/src/variations/fpm-nginx/Dockerfile b/src/variations/fpm-nginx/Dockerfile index 83518d33d..e96b2202e 100644 --- a/src/variations/fpm-nginx/Dockerfile +++ b/src/variations/fpm-nginx/Dockerfile @@ -135,6 +135,7 @@ ENV APP_BASE_DIR=/var/www/html \ PHP_DISPLAY_STARTUP_ERRORS=Off \ PHP_ERROR_LOG="/dev/stderr" \ PHP_ERROR_REPORTING="22527" \ + PHP_FILE_UPLOADS="On" \ PHP_FPM_PM_CONTROL=ondemand \ PHP_FPM_PM_MAX_CHILDREN="20" \ PHP_FPM_PM_MAX_REQUESTS="0" \ @@ -145,6 +146,7 @@ ENV APP_BASE_DIR=/var/www/html \ PHP_FPM_POOL_NAME="www" \ PHP_FPM_PROCESS_CONTROL_TIMEOUT="10s" \ PHP_MAX_EXECUTION_TIME="99" \ + PHP_MAX_FILE_UPLOADS="20" \ PHP_MAX_INPUT_TIME="-1" \ PHP_MAX_INPUT_VARS="1000" \ PHP_MEMORY_LIMIT="256M" \ diff --git a/src/variations/fpm/Dockerfile b/src/variations/fpm/Dockerfile index 33294b908..2d39f76f6 100644 --- a/src/variations/fpm/Dockerfile +++ b/src/variations/fpm/Dockerfile @@ -33,6 +33,7 @@ ENV APP_BASE_DIR=/var/www/html \ PHP_DISPLAY_STARTUP_ERRORS=Off \ PHP_ERROR_LOG="/dev/stderr" \ PHP_ERROR_REPORTING="22527" \ + PHP_FILE_UPLOADS="On" \ PHP_FPM_PM_CONTROL=dynamic \ PHP_FPM_PM_MAX_CHILDREN="20" \ PHP_FPM_PM_MAX_REQUESTS="0" \ @@ -43,6 +44,7 @@ ENV APP_BASE_DIR=/var/www/html \ PHP_FPM_POOL_NAME="www" \ PHP_FPM_PROCESS_CONTROL_TIMEOUT="10s" \ PHP_MAX_EXECUTION_TIME="99" \ + PHP_MAX_FILE_UPLOADS="20" \ PHP_MAX_INPUT_TIME="-1" \ PHP_MAX_INPUT_VARS="1000" \ PHP_MEMORY_LIMIT="256M" \ diff --git a/src/variations/frankenphp/Dockerfile b/src/variations/frankenphp/Dockerfile index 4eef319c3..3418fc969 100644 --- a/src/variations/frankenphp/Dockerfile +++ b/src/variations/frankenphp/Dockerfile @@ -150,7 +150,9 @@ LABEL org.opencontainers.image.title="serversideup/php (frankenphp)" \ PHP_DISPLAY_STARTUP_ERRORS=Off \ PHP_ERROR_LOG="/dev/stderr" \ PHP_ERROR_REPORTING="22527" \ + PHP_FILE_UPLOADS="On" \ PHP_MAX_EXECUTION_TIME="99" \ + PHP_MAX_FILE_UPLOADS="20" \ PHP_MAX_INPUT_TIME="-1" \ PHP_MAX_INPUT_VARS="1000" \ PHP_MEMORY_LIMIT="256M" \