1

I'm using jQuery.post, one of the fields is a large string. it's probably 2MB of text.

The jQuery.post request goes through okay, but this field doesn't exist in PHP's $_POST array. All other posted fields are fine. It's definitely being sent, and is actually in file_get_contents("php://input")

If I reduce the size of the large string, it appears in the $_POST data again.

How can I remove this field size limit so PHP will push the large field into $_POST?

EDIT: I changed post_max_size to 100M and it didn't change anything.

Farzher
  • 13,934
  • 21
  • 69
  • 100

3 Answers3

4

Try Increasing the maximum post size Or check if server haven`t got any additional restricion mechanism like http://www.hardened-php.net/suhosin/

check your phpinfo() and look for any post related limits

Community
  • 1
  • 1
adam187
  • 3,193
  • 21
  • 15
  • I think you're right with that `suhosin` thing. I have `suhosin.post.max_value_length 1000000` which is less than 1MB. I'm having trouble changing it via htaccess though. – Farzher Nov 01 '13 at 17:38
  • From what i remember with my "experience" with `suhosin` this vars can`t be overwritten from `.htaccess`. Maybe this will help http://stackoverflow.com/questions/12718609/how-to-override-suhosin-max-value – adam187 Nov 01 '13 at 17:54
  • Lol, that's a hack and very bad for performance. I can't believe that answer is accepted... I found out there's a `suhosin.ini`, I changed that and it's all good. – Farzher Nov 01 '13 at 19:50
  • I did not say that it`s a perfect solution and you did not say that you have access to configuration files. – adam187 Nov 02 '13 at 06:48
  • It seems Suhosin was enforcing a limit on the number of form elements (or POST variables) that could be submitted in a single form. See http://mou.me.uk/2012/08/20/php-max_input_vars-form-element-limits-and-the-suhosin-patch/ and http://diywpblog.com/how-to-increase-max-input-vars/ – gins t Apr 06 '16 at 08:12
2

It's a server configuration. If you're working with PHP under Linux or similiar, you can control these using .htaccess, like so:

#set max post size
php_value post_max_size 20M

From What is the size limit of a post request?

Community
  • 1
  • 1
Andrew
  • 1,128
  • 1
  • 13
  • 27
0

For the record, There are also other options which might cause missing post data, One would be max_input_vars which defines the number of post variables allowed in a request. It is set to a very high value (1000) by default but in some cases you might wanna increase the number.

Also there is max_input_nesting_level which could also be the cause incase you have many nested variables (this one is by default 64)

Hossein Shahdoost
  • 1,692
  • 18
  • 32