mriedmann / humhub-docker

Alpine-based PHP-FPM and NGINX HumHub docker-container
MIT License
95 stars 77 forks source link

Several issues while increasing file upload size #351

Open zell-mbc opened 1 month ago

zell-mbc commented 1 month ago

I tried to increase the upload size for my Humhub uploads and hit multiple issues which I thought I'd mention.

I started with the Humhub UI where I set the limit to 1000M but was told by the admin UI that php reports only 2MB

So I set PHP_UPLOAD_MAX_FILESIZE: 1024M in docker-compose.yml which didn't seem to have an effect After changing the upload_maxfilesize value in /etc/php8/php.ini of the docker container I ended up with a new 8MB max value, which turned out to come from post_max_size = 8M in php.ini. Changed that as well, and also NGINX_CLIENT_MAX_BODY_SIZE: 1024M in docker-compose-yml and finally got things working.

But because I need these php.ini changes to persist I had to also pull out php.ini to my local filesystem '- ./php.ini:/etc/php8/php.ini` So everything is working for me now but I thought I mention this as a potential subject to address/document.

jvies commented 1 month ago

I think you have to set them all in your docker-compose.yml (if you use the allinone image):

      - PHP_UPLOAD_MAX_FILESIZE=1G
      - PHP_POST_MAX_SIZE=1G
      - NGINX_CLIENT_MAX_BODY_SIZE=1G
zell-mbc commented 1 month ago

That's where I started, but had to revert to changing php.ini after noticing that the vars didn't work.

      - PHP_UPLOAD_MAX_FILESIZE=1G -> Didn't seem to do anything
      - PHP_POST_MAX_SIZE=1G -> Doesn't exist?
      - NGINX_CLIENT_MAX_BODY_SIZE=1G -> Works
dantefromhell commented 1 month ago

My current guess is that this might be related to 99-custom.ini not having any variable substitution applied during container creation.

In my production humhub instance, the content of the file is exactly the same as in source control

# cat /etc/php81/conf.d/99-custom.ini
memory_limit = ${PHP_MEMORY_LIMIT}
max_execution_time = ${PHP_MAX_EXECUTION_TIME}
upload_max_filesize = ${PHP_UPLOAD_MAX_FILESIZE}
post_max_size = ${PHP_POST_MAX_SIZE}
date.timezone = "${PHP_TIMEZONE}"
log_errors = on
error_log = '/proc/self/fd/2'
display_errors = 'stderr'

Also needing to configure 1 value in 4 places via different variables is highly confusing. IMO a better solution would be to have 1 filesize variable that provides the default value for all others. This way one can easily apply 1 value consistently and override individual variables when required.

jvies commented 2 weeks ago

According to https://www.php.net/manual/en/configuration.file.php, this syntax is correct. Moreover, "it works for me " ©

We had issues on this topic on some past versions. Do you use the latest images ?