google app engine PHP - 500上传错误

I have a PHP application running and I'm uploading a PDF for processing. I have not overridden any PHP ini values, so I'm expecting the post to be able to handle 32MB of data and a timeout of 60 seconds.

When I upload a large document (7.7MB in this case), the app fails in 2 very different ways.

  • The back end times out and returns successfully having apparently been passed duff data
  • The backend does not timeout (returning in under a minute) but has an internal server error

The timeout seems to manifest as the back end PHP page getting no data, i.e. whatever is doing the transport times out rather than my page timing out. I can handle this scenario because of the duff data passed in and pass back a useful error message. I don't seem to be able to reproduce this on my local development machine.

The second issue is perplexing as it happens almost immediately on my dev machine and also if the page response is under 1 minute on GAE. I can upload a document of 4.1MB and all is good. The 7.7MB doc causes this every time. The headers look fine and the form data has all the data it needs, although I haven't tried to decode the form data.

Is there another PHP setting causing this? Is there a way to alter this? What could possibly be going on? Could this be a javascript thing as I am using javascript file reader in an HTML5 dropzone - here are the appropriate portions of the handler code:

function loadSpecdoc(file) {
    var acceptedTypes = {
        'application/pdf' : true
    };
    if (acceptedTypes[file.type] === true) {
        var reader = new FileReader();
        reader.onload = function(event) {
            $.ajax({
                url : "my_handler.php",
                type : 'POST',
                dataType : "json",
                data : {
                    spec_id : $('#list_spec_items_spec_id').val(),
                    file_content : event.target.result
                },
                success : function(response) {
                    // Handle Success
                },
                error : function(XMLHttpRequest, textStatus, exception) {
                    // Handle Failure
                },
                async : true
            });
        };
        reader.readAsDataURL(file);
    } else {
        alert("Unsupported file");
        console.log(file);
    }
};

I have heard of the Blob store but I'm on a bit of a deadline and can't find an documentation on how to make it work in javascript, and can't get the file to my PHP application to use it.

Any help much appreciated.

EDIT: I have just checked in the chrome javascript network console and there are 2 sizes in the "Size Content" column, 79B and 0B, I'm guessing that this is the size up (79B) and response (0B). This being the case, this seems to be a javascript issue??

EDIT 2: Just found the log for my application and it says there is a post content limit of about 8MB... not quite the 32MB I was expecting:

06:26:03.476 PHP Warning: Unknown: POST Content-Length of 10612153 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

EDIT 3: Just found this on limits:

https://cloud.google.com/appengine/docs/php/requests#PHP_Quotas_and_limits

I am expecting 32MB of post, assuming I can upload it quick enough :) How do I fix this?