diff --git a/ENVIRONMENT.md b/ENVIRONMENT.md
index 83687f5..c9b78a2 100644
--- a/ENVIRONMENT.md
+++ b/ENVIRONMENT.md
@@ -233,6 +233,8 @@
Sets PHP option `max_input_time`. It is recommended to keep the default (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/files/big_file_upload_configuration.html#configuring-via-php-global-settings)).
- `OWNCLOUD_MAX_UPLOAD=20G` \
Sets PHP option `upload_max_filesize` and `post_max_size`. It is recommended to keep the default (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/files/big_file_upload_configuration.html#configuring-via-php-global-settings)).
+- `OWNCLOUD_MEMORY_LIMIT=512M` \
+ Sets PHP option `memory_limit`. It is recommended to keep the default (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/files/big_file_upload_configuration.html#configuring-via-php-global-settings)).
- `OWNCLOUD_MINIMUM_SUPPORTED_DESKTOP_VERSION=` \
Define the minimum supported ownCloud desktop client version (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-the-minimum-supported-owncloud-desktop-client-version)).
- `OWNCLOUD_MOUNT_FILE=`
diff --git a/v22.04/overlay/etc/entrypoint.d/10-base.sh b/v22.04/overlay/etc/entrypoint.d/10-base.sh
index 2c591dd..aa623dd 100755
--- a/v22.04/overlay/etc/entrypoint.d/10-base.sh
+++ b/v22.04/overlay/etc/entrypoint.d/10-base.sh
@@ -39,6 +39,9 @@ declare -x OWNCLOUD_POST_CRONJOB_PATH
declare -x OWNCLOUD_MAX_UPLOAD
[[ -z "${OWNCLOUD_MAX_UPLOAD}" ]] && OWNCLOUD_MAX_UPLOAD="20G"
+declare -x OWNCLOUD_MEMORY_LIMIT
+[[ -z "${OWNCLOUD_MEMORY_LIMIT}" ]] && OWNCLOUD_MEMORY_LIMIT="512M"
+
declare -x OWNCLOUD_MAX_EXECUTION_TIME
[[ -z "${OWNCLOUD_MAX_EXECUTION_TIME}" ]] && OWNCLOUD_MAX_EXECUTION_TIME="3600"
diff --git a/v22.04/overlay/etc/templates/apache.conf.tmpl b/v22.04/overlay/etc/templates/apache.conf.tmpl
index 14c5d5e..20f8ce2 100644
--- a/v22.04/overlay/etc/templates/apache.conf.tmpl
+++ b/v22.04/overlay/etc/templates/apache.conf.tmpl
@@ -20,5 +20,6 @@
AllowOverride All
Options -Indexes +FollowSymlinks
+ LimitRequestBody 0
diff --git a/v22.04/overlay/etc/templates/owncloud.ini.tmpl b/v22.04/overlay/etc/templates/owncloud.ini.tmpl
index 4792034..8d40e57 100644
--- a/v22.04/overlay/etc/templates/owncloud.ini.tmpl
+++ b/v22.04/overlay/etc/templates/owncloud.ini.tmpl
@@ -4,6 +4,7 @@ apc.enable_cli = 1
upload_max_filesize = "{{ .Env.OWNCLOUD_MAX_UPLOAD }}"
post_max_size = "{{ .Env.OWNCLOUD_MAX_UPLOAD }}"
+memory_limit = "{{ .Env.OWNCLOUD_MEMORY_LIMIT }}"
max_execution_time = {{ .Env.OWNCLOUD_MAX_EXECUTION_TIME }}
max_input_time = {{ .Env.OWNCLOUD_MAX_INPUT_TIME }}
diff --git a/v24.04/overlay/etc/entrypoint.d/10-base.sh b/v24.04/overlay/etc/entrypoint.d/10-base.sh
index 2c591dd..aa623dd 100755
--- a/v24.04/overlay/etc/entrypoint.d/10-base.sh
+++ b/v24.04/overlay/etc/entrypoint.d/10-base.sh
@@ -39,6 +39,9 @@ declare -x OWNCLOUD_POST_CRONJOB_PATH
declare -x OWNCLOUD_MAX_UPLOAD
[[ -z "${OWNCLOUD_MAX_UPLOAD}" ]] && OWNCLOUD_MAX_UPLOAD="20G"
+declare -x OWNCLOUD_MEMORY_LIMIT
+[[ -z "${OWNCLOUD_MEMORY_LIMIT}" ]] && OWNCLOUD_MEMORY_LIMIT="512M"
+
declare -x OWNCLOUD_MAX_EXECUTION_TIME
[[ -z "${OWNCLOUD_MAX_EXECUTION_TIME}" ]] && OWNCLOUD_MAX_EXECUTION_TIME="3600"
diff --git a/v24.04/overlay/etc/templates/apache.conf.tmpl b/v24.04/overlay/etc/templates/apache.conf.tmpl
index 14c5d5e..20f8ce2 100644
--- a/v24.04/overlay/etc/templates/apache.conf.tmpl
+++ b/v24.04/overlay/etc/templates/apache.conf.tmpl
@@ -20,5 +20,6 @@
AllowOverride All
Options -Indexes +FollowSymlinks
+ LimitRequestBody 0
diff --git a/v24.04/overlay/etc/templates/owncloud.ini.tmpl b/v24.04/overlay/etc/templates/owncloud.ini.tmpl
index 4792034..8d40e57 100644
--- a/v24.04/overlay/etc/templates/owncloud.ini.tmpl
+++ b/v24.04/overlay/etc/templates/owncloud.ini.tmpl
@@ -4,6 +4,7 @@ apc.enable_cli = 1
upload_max_filesize = "{{ .Env.OWNCLOUD_MAX_UPLOAD }}"
post_max_size = "{{ .Env.OWNCLOUD_MAX_UPLOAD }}"
+memory_limit = "{{ .Env.OWNCLOUD_MEMORY_LIMIT }}"
max_execution_time = {{ .Env.OWNCLOUD_MAX_EXECUTION_TIME }}
max_input_time = {{ .Env.OWNCLOUD_MAX_INPUT_TIME }}