如何使用post请求将非常长的字符串从js传递给php?

I have a big html table page generated by jQuery and php. In this page there is a button to export the table in excel. When I click this button, the script prepare the string and send a POST request to PHP.

The sent string has a total of about 60000 chracters. When I do $_POST in the php page, the php server crashes.

I have alredy changed the php.ini file in the following way:

max_input_vars = 15000
memory_limit = -1
upload_max_filesize = 100M
max_file_uploads = 20

This still does not work.

There is some method or workaround to resolve this issue? I try to modify my code a lot of time.

This is the code:

JAVASCRIPT AJAX REQUEST

function esporta(tipo,id,header,dati){
    var dataString = "id="+id;

    if(tipo == "excel"){
        if(header != ""){
            dataString += "&header="+header;
        }else{
            dataString += "&header=vuoto";
        }

        dataString += "&dati="+dati;
    }

    if($.trim(id).length>0){
        $.ajax({
            type: 'POST',
            url: 'lib/excel-export.php',
            data: dataString,
            cache: false,
            beforeSend: function(){ 
                $('.se-pre-con').fadeIn('slow');
            },
            success: function(data){
                $('.se-pre-con').fadeOut('slow');
                if(data){
                    if(data == 'errore'){
                        alert('Errore!');
                    }else{
                        document.location = "lib/download.php?nomefile="+data;
                    }
                }else{
                    alert('Errore! Mancata restituzione dei dati!');
                }
            }
        }); 
    }
}

PHP

...
$sheets = $wkb->Worksheets(1); #Select the sheet
$sheets->activate; #Activate it

$postheader = $_POST['header'];
$postdati = urldecode($_POST['dati']);

$header = explode(";",$postheader);
$dati = explode(";",$postdati);
...

The following code

$postdati = urldecode($_POST['dati']);

crashes the server (if I comment out this line, the server doesn't crash). In the excel there are only 30000 characters.

Please note that I can't perform database query in the PHP page. I have to take the data from that table.

I use appserver.io webserver on my local PC.

Thank you in advance.

60,000 characters is merely 60KB, or a little bit more depending on character encoding.
Have you checked the post_max_size directive of your php.ini?

From php.ini's comments:

Maximum size of POST data that PHP will accept. Its value may be 0 to disable the limit. It is ignored if POST data reading is disabled through enable_post_data_reading. http://php.net/post-max-size