0

I have a textarea, it works fine if there are less than 1 million characters. As soon as something is posted over 1 million characters that field is missing in $_POST (all other fields are posted).

What could be causing this? When searching all I have seen mentioned is there are no character limits only post size limit and memory limit. No errors are being displayed and these are set well over the 2Mb text size.

user4287915
  • 366
  • 2
  • 11
  • 1
    This could be related to your web server settings. What server are you using? – sunny Aug 15 '15 at 22:07
  • Apache with nginx proxy – user4287915 Aug 15 '15 at 22:09
  • I don't know anything about this area, but you should check your server docs and look for SO posts like this one: http://stackoverflow.com/questions/11686288/apaches-limit-to-post-request-size – sunny Aug 15 '15 at 22:09
  • 1 million characters is an awful lot of data for a textarea box. Why not simply use a file upload option? As far as I'm aware there is no "hard limit" on a textarea. Try setting the maxlength = 1000001 (HTML5 tag) just to see if you can indeed obtain more than 1 million characters – John Crawford Aug 15 '15 at 22:25
  • Apparently LimitRequestBody is set to 0 by default with my control panel. I tried manually setting it in httpd.conf but it made no difference. The content is dynamically generated string (PGP encryption) which is then posted to the server. Problem is if the block is over 1 million characters (appx. 524Kb) it vanishes. – user4287915 Aug 15 '15 at 22:41

2 Answers2

1

Managed to solve the issue, it was suhosin limiting the characters. I needed to set the following:

suhosin.request.max_value_length = 100000000
suhosin.post.max_value_length = 100000000
user4287915
  • 366
  • 2
  • 11
0

Did you try increasing post_max_size in php.ini file?

Moreover, you can also use some other way to post your data i.e use:

//execute an async method
function curl_request_async($url, $params, $type='GET'){

    $post_params = array();
    foreach ($params as $key => &$val) {
        if (is_array($val)) $val = implode(',', $val);
        $post_params[] = $key.'='.urlencode($val);
    }
    $post_string = implode('&', $post_params);

    $parts=parse_url($url);
    $fp = fsockopen($parts['host'],
        (isset($parts['scheme']) && $parts['scheme'] == 'https')? 443 : 80,
        $errno, $errstr, 999999999);

    $out = "$type ".$parts['path'] . (isset($parts['query']) ? '?'.$parts['query'] : '') ." HTTP/1.1\r\n";
    $out.= "Host: ".$parts['host']."\r\n";
    $out.= "Content-Type: application/x-www-form-urlencoded\r\n";
    $out.= "Content-Length: ".strlen($post_string)."\r\n";
    $out.= "Connection: Close\r\n\r\n";
    // Data goes in the request body for a POST request
    if ('POST' == $type && isset($post_string)) $out.= $post_string;

    fwrite($fp, $out);
    fclose($fp);
}

You can call this function like:

$url = "somefile.php";
$data['mydata'] = "some data some data some data";
curl_request_async( $url, $data, 'POST' );

Note:

Do not use any type of Session based authentication in file "somefile.php". And you can access post data like $_POST['mydata']. You can also call this function in by GET. Don't know what you are actually looking for.

hmd
  • 960
  • 2
  • 9
  • 13