2

I have installed Moodle 3.2 on Ubuntu server 16.04. I am not able to upload files bigger than 2 MB . The error I get is:

enter code hereThe uploaded file exceeds the upload_max_filesize directive in php.ini.

I changed the entry in /etc/php/7.0/cli/php.ini to 800M. I also created an .htaccess file in Moodle directory with the following entries.

php_value upload_max_filesize 2097152000
php_value post_max_size 2097152000
php_value max_execution_time 6000

In spite of this I am not able to post any files greater than 2 MB in Moodle. Please suggest.

Zanna
  • 72,312

2 Answers2

1

From php.net:

post_max_size
Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be larger than post_max_size.

From answer of similar question in Stack Overflow:

upload_max_filesize is the limit of any single file. post_max_size is the limit of the entire body of the request, which could include multiple files.

Given post_max_size = 20M and upload_max_filesize = 6M you could upload up to 3 files of 6M each. If instead post_max_size = 6M and upload_max_filesize = 20M then you could only upload one 6M file before hitting post_max_size.

By default (in PHP 7.0) the value of post_max_size is four times larger than the value of upload_max_filesize:

post_max_size = 8M
upload_max_filesize = 2M
pa4080
  • 30,621
0

I found the best place to put the values for Apache is in the Per directory options under PHP.. for the Website needing the values.. It's called PHP configuration values under webmin or use the site .conf like this one of my conf files