3

I have uploadify running on Plesk/apache set to FastCGI uploading to an uploads file melow the document root. This seems to work with files less than 1MB but creates an ERROR 500 on anything larger.

$(function() {


var idx=$('.useri').val();
$('#file_upload2').uploadify({
    'multi'    : false,
    'swf'      : 'images/uploadify.swf',
    'uploader' : 'admin_includes/uploadify.php',
    'formData'  : {'user_id': idx},
    'fileSizeLimit' : '10MB',
    // Put your options here
    // Some options
    'onUploadSuccess' : function(file, data, response) {
        if(data==2)
        {
            alert("File Extension needs to be either .docx, .doc or .pdf");
        }
        else
        {
            var data_split=data.split("|");
            $('.title_holder').fadeIn(200);
            $('.upload_hider').show();
            $('.added_file').html("");
            $('.message12').html('<p class="added_file" data-file2='+data_split[1]+'>'+data_split[0]+' Successfully Uploaded.</p>');

        }
    }
});
});

I have also set php.ini as follows

safe_mode = Off
upload_tmp_dir /tmp
upload_max_filesize = 40M
post_max_size = 40M

This does not seem to work either. Is there anything that I am missing or seem to have done wrong ?

Charles
  • 50,943
  • 13
  • 104
  • 142
Sideshow
  • 1,321
  • 6
  • 28
  • 50
  • An Apache `LimitRequestBody` perhaps? – Wrikken Dec 12 '12 at 15:49
  • 2
    did you look at your webserver error log file? that usually yields the answer – Barry Chapman Dec 12 '12 at 15:53
  • 1
    don't forget php's memory_limit - you need a limit slightly higher than post_max_size. And as Barry says, check your server's error log. more details about the 500 code will be there. – Marc B Dec 12 '12 at 15:55
  • memory limit is set to 120M - Error logs don't deem to through anything up except a warning about IE buffering of what errors are likely to come through (nothing under 512 chars). Other things I have noticed in php_infp is upload_tmp_dir is showing 'no value'. – Sideshow Dec 13 '12 at 08:59
  • What's your script execution time limit? – Max Jan 02 '13 at 15:49
  • max_execution = 120, max_input_time = 120 although I have tried 300 – Sideshow Jan 02 '13 at 15:55
  • 1
    A *500 Internal Sever Error* is ***always*** an invitation to look into the servers error log. It contains more information. As this is PHP, it's also highly likely that it is because of a *Fatal Error in PHP*, so ensuring that PHP error logging is enabled and looking into the PHP error log is very useful, too. [More about the 500 Internal Server Error](http://stackoverflow.com/a/13940190/367456) --- saying so and because you already commented back to a similar hint: In your apache error log file there *is* a corresponding entry for your 500 error. You need to find it and add it to Q. – hakre Jan 05 '13 at 20:48
  • Thanks hakre - I have found the problem now as posted below but to expand on what you have said for future use the error in the error log is: "mod_fcgid: HTTP request length 131388 (so far) exceeds MaxRequestLen (131072)" – Sideshow Jan 06 '13 at 10:05
  • Marc B, this post : http://stackoverflow.com/questions/3651141/in-php-settings-should-memory-limit-upload-max-filesize indicates that memory_limit and post_max_size are unrelated. – regilero Jan 07 '13 at 16:03

3 Answers3

2

Try setting the sizeLimit option as

'sizeLimit': 5000000000

Also, as a suggestion, you could try subscribing to the onError handler in your uploadify call. Something like this, after the onUploadSuccess handler...

onError: function(a, b, c, d) {
    if (d.status == 404) alert('Could not find upload script.');
    else if (d.type === "HTTP") alert('error ' + d.type + ": " + d.status);
    else if (d.type === "File Size") alert(c.name + ' ' + d.type + ": " + d.status);
    else alert('error ' + d.type + ": " + d.text);
}​
palaѕн
  • 72,112
  • 17
  • 116
  • 136
1

Thanks for the help but I seem to have solved the problem. What I have failed to say in this thread is that my server has Plesk 10.3.1 installed. It appears that this version of Plesk overwrites the maxRequestLen in the server configuration to something like 128Kb.

The solution was to reset this to 1GB (normal default size) or required size in either /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php or /etc/httpd/conf.d/fcgid.conf and restart the server.

Future versions of Plesk do not have this problem as far as I am aware.

Sideshow
  • 1,321
  • 6
  • 28
  • 50
0

You are likely getting an error related to PHP configuration. Besides upload_max_filesize and post_max_size, you should have values for:

max_execution_time
max_input_time

Both define the maximum life time of the script and the time that the script should spend in accepting input.

inigomedina
  • 1,791
  • 14
  • 21
  • True - these have been added to my php.ini although the default values (unless requiring huge file uploads of upto 1GB is required) seem to be adequate. I have set file size limits within the upload script to 15MB so there does not seem to be an issue with this. Thanks :) – Sideshow Jan 06 '13 at 10:09