moodle-docker
moodle-docker copied to clipboard
PHP: upload_max_filesize set to 2MB
The PHP container seems to default to 2MB in its php.ini config for upload_max_filesize.
Can the upload_max_filesize and post_max_size configs be set to higher values, like 2GB?
Hi @rlorenzo,
there already was a discussion about a better php.ini
settings in #9 but no one, including me, proposed something at that time.
Thanks for rising! Matteo
We implemented this on our fork: https://github.com/ccle/moodle-docker/commit/7b760ecdb5be80b47524db4de7f8e72e3f54bf9a
Not sure if this was the best method, but let us know if you want a similar patch made for this repo.
Hi @rlorenzo,
https://github.com/ccle/moodle-docker/commit/7b760ecdb5be80b47524db4de7f8e72e3f54bf9a#diff-3254677a7917c6c01f55212f86c57fbfR16 looks OK - I'd like to add more stuff like something as max_execution_time
(https://docs.moodle.org/33/en/PHP#PHP_Settings) but here is out-of-scope -, not the mysql stuff which would be:
- a separate issue
- do not build a local image: add the custom values via a mount to
/etc/mysql/conf.d
as explained in https://hub.docker.com/_/mysql/, including a trailing:Z
(more at https://www.projectatomic.io/blog/2015/06/using-volumes-with-docker-can-cause-problems-with-selinux/)
Edit: would you like to propose a PR? Otherwise, I'll do it.
HTH, Matteo
Any chance for merging commit 7b760ecdb5be80b47524db4de7f8e72e3f54bf9a @scara ? We need configurability for php.ini to increase the maximum memory.
Can I ask what you need it increasing for? Happy to increase it but would be good to get more info to make sure the new amount is right.
Just to run it:
➜ sudo -E bin/moodle-docker-compose exec webserver php admin/tool/behat/cli/run.php
Running single behat site:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/lib/testing/classes/util.php on line 288
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1052672 bytes) in /var/www/html/cache/stores/file/lib.php on line 368
To re-run failed processes, you can use following command:
php admin/tool/behat/cli/run.php --rerun
But the Moodle instance I have here is heavily modified one. I simply set up the maximum memory to 1G.
Okay, so out of the box Moodle works fine with the standard memory allocation.
I think we have a few options:
- add a hard-coded php.ini to the image in moodlehq/moodle-php-apache
- add a hard-coded php.ini which is mapped in the docker-compose.yml in these scripts
- add a php.ini directory here which is mapped to the includes directory in the docker-compose.yml in these scripts
I feel like a mapped directory may be the way to go as it allows more future flexibility for people to add their own configs but thoughts are appreciated.
So basically we should copy extra config into $PHP_INI_DIR/conf.d/ directory, as per https://hub.docker.com/_/php/#configuration
Mapping could be a way to go, for example we add optional MOODLE_DOCKER_PHP_EXTRA_CONFIG environment variable.
If set, then bin/moodle-docker-compose will map MOODLE_DOCKER_PHP_EXTRA_CONFIG into container's $PHP_INI_DIR/conf.d/ .
https://github.com/ccle/moodle-docker/commit/7b760ecdb5be80b47524db4de7f8e72e3f54bf9a
That seems to be a 3 line edit and should work perfectly for the vast majority of people. I'm okay with that.
Would be much easier, when it would be in the moodle-php-apache image?
Why MoodleHQ can not set it per default at least to 100 MB
?
For us we've now added a new configuration file to https://github.com/moodlehq/moodle-php-apache/tree/master/root/usr/local/etc/php/conf.d. As we're already using a custom image in moodle-docker
due customizations.
Greets Adrian
Hi,
I'm closing this now beacuse @ https://github.com/moodlehq/moodle-php-apache/pull/171 we are going to raise it to 200MB, plus now there are options in the php images to pass any arbitrary ini setting or init script.
Ciao :-)