Chamilo big files upload fails on some cPanel

Recently I've had to fix a very strange cPanel installation of Chamilo. For some reason small files could be uploaded but not large files. Modifying the .htaccess file to add post_max_size and upload_max_filesize didn't work. The problem was due to two things, really:
  1. the re-configuration of php settings could only be done through local php.ini files (which only work for one directory, non-recursive, so you have to apply in several places)
  2. for some very strange reason, the upload_tmp_dir setting was undefined, which apparently didn't work as I would have expected: it didn't store temporary uploaded files in the /tmp directory of the server. I had to set this one manually (in a local php.ini file) to /home/myuser/public_html/www/chamilo/archive/ (feel free to put it somewhere else) to get it to work.
The resulting php.ini file looked like this:
post_max_size = 133M upload_max_filesize = 133M memory_limit = 256M max_execution_time = 300 upload_tmp_dir = /home/myuser/public_html/chamilo/archive/
In the hope this helps somebody out there in the future...

Comments

This has really helped me ... thank you.

I am having trouble getting chamillo prestashop login to work ... is there any other shopping cart plugin that you can suggest or a user guide? also will like to contact you considering possible future extensions of the education aspect of chamillo for mathematics education in particular ... I have researched the area of adaptive educational technologies for 7 years

I welcome a joint effort with beeznet and the group to achieve this goal

In reply to by YW

Permalink

Hi Ricardo,

Inside the latest version of the Prestashop package, there is a Readme file which explains how to install. It's pretty easy, really, so please follow it and if you think one of the step is not documented well enough, please let us know so we can improve it.

Sending you contact information in case your requirements for new developments are confirmed...

Yannick, please help me. I am so new to all of this, but a friend installed Chamilo for me. I am trialing the 30 day captivate so don't have much time left.to decide. I could upload a 4 page project as scorm quite easily to Chamilo, but sadly a 28mb file fails with a message that the file size is too big.
I am told server php.ini files are set to 64mb by default so the 27.8mb
Should I upload to ftp instead? which folder would the captivate project zip go into if I did that?
Riesa

In reply to by YW

Permalink

Hello Riesa,

Files uploads might fail for several reasons, but if you are using Chamilo LMS 1.9.10.2, I recommend you check out a very recent fix I sent to main/newscorm/learnpath.class.php: go here and click on "raw", then save the page and replace (after saving a copy) your own main/newscorm/learnpath.class.php. This might just work.

thanks. I struggled a little as I've never touched a php file in my life but it opened in adobe dreamweaver and I managed to copy paste the old code over the new and ftp it back into my Chamilo LMS folder. I'll let you know shortly if it works.
Thanks so much for helping me. I really appreciate your time and effort.
Kind regards,
Riesa

Well I thought it was going to work as it got to 100%, but then I got a message that was "
Fatal error: Call to undefined method learnpath::getProgress() in /home/learnbys/public_html/lms/main/newscorm/lp_list.php on line 229"
and it also said, file too big to upload.
Kind regards,
Riesa

In reply to by YW

Permalink

OK, that's because of other changes in the learnpath.class.php file. New strategy: recover the original file (remember the "after saving a copy" bit?). Then apply carefully the changes here: https://github.com/chamilo/chamilo-lms/commit/e39ceab4e91918f6e193ca28a…
All green lines are new lines inserted inside the existing function "verify_document_size". Don't copy the number and the "+" sign at the beginning of each line.
If the whole file fixed the issue with the progress percentage, then changing just this bid in your previous file should definitely fix the issue!

In reply to by YW

Permalink

I'm just about to put the extra text in but the line beforehand looks different to me. It says function instead of public function. Here's a little section of your fix:-
public function verify_document_size($s)
and here's my document before I change it:-

function verify_document_size($s)
{
$post_max = ini_get('post_max_size');
$upl_max = ini_get('upload_max_filesize');
$documents_total_space = DocumentManager::documents_total_space();
$course_max_space = DocumentManager::get_course_quota();
$total_size = filesize($s) + $documents_total_space;
if (filesize($s)>$post_max || filesize($s)>$upl_max || $total_size>$course_max_space ){
return true;
} else{
return false;
}

In reply to by YW

Permalink

ie it doesn't public before function. dunno if that matters. I'm not a programmer.

In reply to by YW

Permalink

You can still get the original file by downloading the original Chamilo 1.9.10.2 package.

I think I had the right file and did it correctly, and I think I chose my scorm zip that worked when I sent a smaller file, but I got this message after the upload got to 100% complete:-
The package you are trying to upload has an unknown format. Please check it uses one of the supported formats.

In reply to by YW

Permalink

Is your large file compatible with SCORM 1.2? Sometimes it will say this if your SCORM version is 2004 (which is NOT supported by Chamilo).

Well I can still load a small file and not a big one. I put in all the green bits into my old file that I had saved (I think). And then I tried to upload a scorm file zip and all was good. but my big one won't work.

This is a part of my current file. It doesn't have the word public before function verify_document etc. Does that matter at all?

//Course restorer
$course_restorer = new CourseRestorer($course);
$course_restorer->set_add_text_in_items(true);
$course_restorer->set_tool_copy_settings(array('learnpaths' => array('reset_dates' => true)));
$course_restorer->restore(api_get_course_id(), api_get_session_id(), false, false);
}

function verify_document_size($s)
{
$post_max = ini_get('post_max_size');
if (substr($post_max, -1, 1) == 'M') {
$post_max = intval(substr($post_max, 0, -1)) * 1024 * 1024;
} elseif (substr($post_max, -1, 1) == 'G') {
$post_max = intval(substr($post_max, 0, -1)) * 1024 * 1024 * 1024;
}
$upl_max = ini_get('upload_max_filesize');
if (substr($upl_max, -1, 1) == 'M') {
$upl_max = intval(substr($upl_max, 0, -1)) * 1024 * 1024;
} elseif (substr($upl_max, -1, 1) == 'G') {
$upl_max = intval(substr($upl_max, 0, -1)) * 1024 * 1024 * 1024;
}
$documents_total_space = DocumentManager::documents_total_space();
$course_max_space = DocumentManager::get_course_quota();
$total_size = filesize($s) + $documents_total_space;
if (filesize($s)>$post_max || filesize($s)>$upl_max || $total_size>$course_max_space ){
return true;
} else{
return false;
}
}

/**
* Clear LP prerequisites
*/
function clear_prerequisites()

Hi Yannick,
I redownloaded the Chamilo 1.9.10.2 package and got out the learnpath.class.php file (after saving a copy), and I edited it in dreamweaver cutting and pasting the bits of code and deleting the + signs after. However I still can't upload a big file and am getting this message about the format
The package you are trying to upload has an unknown format. Please check it uses one of the supported formats.
Except that I am picking the format using the preferences in adobe captivate, and it worked for a smaller file. I tried both responsive and unresponsive projects.
Kind regards,
Riesa

Hello Yannick,
I published my captivate project as AICC and it still gave a message saying The package you are trying to upload has an unknown format. Please check it uses one of the supported formats.

but at least I'm not getting the too big message anymore.
Maybe because i made the videos for the presentation on mac that I am having trouble, but they play okay on my website in an iframe.
Riesa

In reply to by YW

Permalink

Hi Riesa,
At this point, there's not much I can do short of testing your content, which is a specific case, which I will not do on my spare time (I prefer spending it improving Chamilo for the masses rather than for one specific case, sorry). Chamilo LMS handles well Captivate format (we have many working case of SCORM 1.2 packages of more than 300MB) , but the error messaging sometimes is a bit messy (meaning "wrong format" might mean something else that the system is unable to express in details). So I believe there might still be something wrong with your setup. The last thing I can recommend is that you check the total time it takes to upload the big file. If it takes you a long time, then there is a setting in PHP that prevents uploads to take too long. Check in php.ini for max_input_time (and increase it, obviously). It is defined in seconds, and if the current number of seconds seems to be around the time your upload stops and shows the wrong format message... this might be it.

Hi Yannick,
I doubt if that is the problem. The upload does take a long time, but since we fixed the big file code problem, the file gets to 100% just before the message appears. My bet is that it is some funny mac format that I chose for one of the videos in the scorm package.
I understand that you can't fix this for me.
Thanks for all your help so far anyway.
Kind regards,
Riesa

In reply to by YW

Permalink

but they all say mp4 - however I understand there are different types of MP4

By the way I did try the demo website of king lms but the file wouldn't upload there either and the error message suggested that maybe the file was too big.
Kind regards,
Riesa

OK I have an answer but not the solution to my problem. I have 3 different videos in the scorm project as well as a quiz. Taking the two small videos out doesn't upload. Taking the big video out but leaving the small vids in uploads. Reducing the quality of the big vid and removing the two little vids works!
so it is either a problem with the file size or it is a problem with the number of videos in a project. could you please tell me if the number of videos is limited in chamilo or if there is a setting to adjust this? Also in the php.ini the time is set max exe around 3600 I'm told which was enough time for the file that contained 3 videos to upload, so that isn't the problem.
Kind regards,
riesa

Also I have noticed that the file only gets to 99% when it uploads and not to 100% no matter what the file size. I am sure I saw 100% during my previous experiments, but not yesterday.
Riesa

In reply to by YW

Permalink

Hi Riesa,

The number of items *inside* the ZIP have no influence at all.
max_execution_time 3600 is far enough to deal with uncompressing a big zip file (300 should already be enough)
I honestly don't get why changing the size of your videos would help the system work. I can only guess that there's not enough memory to deal with uncompressing the big video file...

In reply to by YW

Permalink

Maybe you could try making sure that your memory_limit is higher than the largest file in your ZIP...

In reply to by YW

Permalink

That's in your php.ini, close to the max_execution_time

Ok, i'll ask my webhost to do it as I don't think I have access to that file. I'll let you know how I get on but i think it will take a few days.
Kind regards,
Riesa

I asked my webhost and this is what he said:-
"whatever the problem is, it is not the server php.ini file.
I'm running the current version of php5+
the ini file is set to max upload of 64mb with a timeout of 3600 and a memory limit of 256mb.
there are some 70 odd other php applications running on the server with no problems so whatever the problem is it seems unique to Chamilo."

and in a further email he said:-
"I have never heard of any application using a php.ini file other than the server php.ini file. The info you sent talks about using a local php.ini file - they do not elaborate on what that means nor do they specify what folder or folders to put it in - Are they suggesting to create a php.ini file and upload it somewhere to the Chamilo installation? - again, I've never heard of this practice so I can't help with that one , sorry."

In reply to by YW

Permalink

Riesa, could I ask you to try and upload your document on https://stable.chamilo.org (you can login as admin/admin and create a course in which to upload your content, and then delete it afterwards if it works, to maintain privacy), and then on https://unstable.chamilo.org (same thing)?
stable.chamilo.org is the latest Chamilo 1.9 development branch
unstable.chamilo.org is the latest Chamilo 1.10 development branch (not yet released)
Trying it there will give us a good standard base to try and find what's wrong.

Thanks. well that is interesting. it uploaded perfectly happily to the stable one. The stable one is the one I supposedly have isn't it?

This is my version of chamilo that won't upload. Administrator : blah blah
Portal Chamilo 1.9.10.2 © 2015

Now i see the way it is meant to look and work. My webhost installed chamilo for me. I wonder if my installation is somehow faulty? Or is there some other cause that you can think of?

Kind regards,
Riesa

Do I still need to upload to the unstable version or do we have enough information now?

No, you don't need to test unstable. stable.chamilo.org is a 1.9.10.2 with a few fixes, but the only one that should affect you is the one I asked you to apply on your installation, so we're back to your hosting. I'm sorry you're having issues on your webhosting. Maybe consider one of the options offered by BeezNest (since you're on our website anyway) under "product".
My help ends here, given I've kind of proven my point and I can't do anything about your hosting (and they seem to have gotten up on the wrong foot as well).
Note that many other hosting solutions should be just fine (I guess). We're specialized in Chamilo, so that's what we do. I can't guarantee it will work with Chamihost given we're outsourcing the hosting for that one, but with Chamilo Light we can guarantee it (because we'll be discussing with you your best option and ensure you're good to go).

OK thanks. Well my current host is trying to figure out a way. He's downloaded and installed a version of chamilo and is testing. He also got a wrong file format message. I'll remind him to instal your newest fix.
thanks for all your help with this. If I don't get anywhere I will look at that alternate hosting option.
Kind regards,
Riesa

In reply to by YW

Permalink

I'm trying free 15 day trial of chamihost and my file now uploads fine.
However the captivate project i uploaded loads forever flashes a bit and never finishes loading or plays. However it plays fine on https://stable.chamilo.org
I also was able to upload the file on my chamilo installation by unzipping the file, taking the videos out, then zipping back up and uploading, and then putting the videos in by ftp. However the same problem with loading continually and never playing the project occurs.
Kind regards,
Riesa

Hi Yannick,
all fixed. It was a security setting on my host's server and nothing to do with php.ini
All working beautifully now and I'm very happy.
Kind regards,
Riesa

In reply to by YW

Permalink

Great news! Have fun and thanks for reporting on the final issue! (if you have more details and it can help someone else, don't hesitate to publish it)

Hi Yannick I'm observing quite the same issue from my side. I updated to 1.9.10.2, changed the file you talked about but nothing change.

I created a course and try to upload some MP4 files. All worked but not the one which weight is just 11M.

My php.ini is ok. I don't understand. I don't get any error message but it blocks at about 30% of the bar.

In reply to by YW

Permalink

In documents folder

In reply to by YW

Permalink

Hi Yadan, not sure what your problem might be. It might depend on your web server configuration, on your network or other stuff like that. Make sure you check with your host provider and, in the best case, if you have another PHP application on the same server, it might help checking if large file uploads are allowed on this one.

sir i was testing to install chamilo on a cheap or say free webhost that was 5gb free but i was unsuccess ful as it take a long time to install and then also it was not install

Hi Yannick,
I have the 1.10.2
I can upload with a success message, both a 40mb file and a 400mb file. My host has allowed me a 450mb limit. However although the small course can be found and played, the bigger course does not show up anywhere in chamilo, despite me having been given a successful upload message (the upload took a long time and slowly upped percentage so it looks like it really did upload). I am on mac.
Riesa

I took the videos out and then was able to upload the scorm. Then I can transfer the videos back in via ftp without using chamilo for the upload ie separately. If i leave the videos inside the scorm zip and upload to chamilo, as I said in my previous messages, I get a successful upload message, but when I look in my ftp inside the folder called app which has a folder called courses and the name of my course - inside that folder a .htm gets created after upload but not the rest of the scorm. ie I should not be getting a success message after upload because clearly nothing has uploaded so I am certain that this is a chamilo bug. I have some very long file names in my video, capital letters and gaps between words, so I am trying an upload again, and renaming all my videos first to make them shorter and simpler to see if that helps.