PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Zied ALAYA-mit -
Antal besvarelser: 12

I want to increase the size of files I can upload. I updated the values of php.ini serttings file but when I try to upload any file bigger then 10Mo I got an error. Any idea please ? (Moodle 3.5.1 ; Ubuntu server 18.04 ; Apache 2 ; PHP 7.2)

/etc/php7.2/apache2/php.ini
          ; Maximum allowed size for uploaded files.
          upload_max_filesize = 60M
          ; Maximum size of POST data that PHP will accept.
          post_max_size = 60M
          ; Maximum amount of memory a script may consume (128MB)
          memory_limit = 128M


in coursesettings administration page , I have already moodlecourse | maxbytes is set to 60Mo after I updated php.ini file.
other setting values :

  • moodlecourse | maxbytes is set to 60Mo.
  • workshop | maxbytes is set to 60Mo.
  • assignsubmission_file | maxbytes is set to 20Mo.
  • forum_maxbytes is set to 20Mo.
  • maxbytes  is set to 60Mo.


I checkek in VirtualHost files and there is no varaible with LimitRequestBody.
Any idea please ?

Gennemsnitsbedømmelse: -
I svar til Zied ALAYA

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Howard Miller-mit -
Core developers-ip assinga Documentation writers-ip assinga Particularly helpful Moodlers-ip assinga Peer reviewers-ip assinga Plugin developers-ip assinga

Is that *definitely* the ruling php.ini file? Don't say 'yes'. In Moodle, Site administration > Server > PHP Info. It says near the top which php.ini file(s) it is loading. 

I assume you restarted Apache after making changes to php.ini?

I svar til Howard Miller

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Zied ALAYA-mit -
Yes I restarted apache. I tried to change values and Moodle detect and set the new maximum value each time.
following your advice, I double checked PHP Info, and it's the one I modified :
Configuration File (php.ini) Path         /etc/php/7.2/apache2

I svar til Zied ALAYA

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Colin Fraser-mit -
Documentation writers-ip assinga Particularly helpful Moodlers-ip assinga Testers-ip assinga

I found that in nGnix there was more than one php.ini file. Most times, upload sizes did not get changed unless I made the same edit in all files, irrespective of what the path to ini file said in the PHP Info display. Do a find for all php.ini files and see what you get. 

I svar til Colin Fraser

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Zied ALAYA-mit -

thanks for the hint but did not solve my issue. I changed upload_max_filesize = 60M ,   post_max_size = 240M  in all php.ini files and still have the same message "The file 'file_name' is too large and cannot be uploaded".

$ sudo find -iname php.ini
./etc/php/7.0/apache2/php.ini
./etc/php/7.2/apache2/php.ini
./etc/php/7.2/cgi/php.ini
./etc/php/7.2/cli/php.ini

I svar til Zied ALAYA

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Zied ALAYA-mit -
I fond that there is a .htaccess in the moodle website directory.
I installed Moodle via git and it was created automatically. Here the .htaccess content:

php_value upload_max_filesize 838 860 800
php_value post_max_size 838 860 800
php_value max_execution_time 600
if I suppose that 838860800 is in Bit, it will be 100Mo but in my case a file with 13Mo size is rejected.

What should I do ?
I svar til Zied ALAYA

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Howard Miller-mit -
Core developers-ip assinga Documentation writers-ip assinga Particularly helpful Moodlers-ip assinga Peer reviewers-ip assinga Plugin developers-ip assinga

"I installed Moodle via git and it was created automatically"

No it doesn't. Well, no it shouldn't. That's a bit of a worry. "Normal" Moodle doesn't do that so you really need to ask yourself how that .htaccess file got there. 

There's nothing else around is there? That is, have you installed Moodle under some other application (Wordpress?) that could be causing this?

I svar til Howard Miller

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Zied ALAYA-mit -

hmmm, other application yes (phpmyadmin via apt command).

May be it was the source of problem but I don't think so (it did not creates such file in other servers I have).

I changed html/.htaccess but it did not solve the issue

php_value upload_max_filesize 60M
php_value post_max_size 240M
php_value max_execution_time 600
I deleted it also but still got the same error.

I fond 2 other htaccess under moodledata (I never created this files) : moodledata/.htaccess and moodledata/temp/.htaccess

here moodledata/.htaccess

deny from all
AllowOverride None

and here moodledata/temp/.htaccess

deny from all
AllowOverride None
Note: this file is broken intentionally, we do not want anybody to undo it in subdirectory!


I svar til Zied ALAYA

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Howard Miller-mit -
Core developers-ip assinga Documentation writers-ip assinga Particularly helpful Moodlers-ip assinga Peer reviewers-ip assinga Plugin developers-ip assinga

The moodledata ones are correct and are nothing to do with it. 

Go to Site administration > Server > PHP Info. 

Find the upload_max_filesize, post_max_size settings in the list. What does it say?

I svar til Howard Miller

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Zied ALAYA-mit -

Thanks for the information about .htaccess of moodledata.

Site administration > Server > PHP Info  says :

upload_max_filesize 
   60M
post_max_size
  240M




I svar til Zied ALAYA

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Zied ALAYA-mit -

I finally discovered the source of the problem and solved smiler

It's in the course settings:

d

Thanks every body for your precious help and time smiler

I svar til Zied ALAYA

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Colin Fraser-mit -
Documentation writers-ip assinga Particularly helpful Moodlers-ip assinga Testers-ip assinga

Hahahahahaaaaaa! The one thing we didn't mention...stort grin - ROFLMAO

That's OK, we're all experts at this.... 

I svar til Colin Fraser

Re: PHP - Ubuntu 18.04: maximum upload limit is always 10Mo

Zied ALAYA-mit -

stort grin stort grin that's right Colin.

the good point is that I know more things about "my" Moodle server after all this verifications