Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

max size of a php post?

Tags:

post

php

Could it be that a POST request is limited to size? I have a large procedure I want to cache the output from. Basically I want to store a lare html-table in cache because of the growth a particulary project, the number of queries and thereby the responsetime is getting out of hand.

Now i'm sending the large output which is retrieved by an ajax-call, in another ajax-call (after the first one completes), but I only get a small piece of the data back. I think my ajaxfunction is correct because the stored output is always the same (in characters). But I'm missing about 90% of the output in the cache...

like image 998
Ben Fransen Avatar asked Oct 03 '11 17:10

Ben Fransen


3 Answers

there is an 8 Mb max size for the POST method, by default (can be changed by setting the post_max_size in the php.ini file).

"Could it be that a POST request is limited to size?"

Yes, there is a PHP setting: post_max_size

like image 112
Patrick Desjardins Avatar answered Oct 25 '22 11:10

Patrick Desjardins


I just ran into this problem myself and found that since PHP 5.3.9 there is a new setting available which restricts the total number of post variables (not just the size).

max_input_vars = 1000

This may have been the same issue you were running into if you were using a nightly or release candidate version of PHP at the time.

like image 32
norganna Avatar answered Oct 25 '22 11:10

norganna


Look for these settings in your php.ini

; Maximum size of POST data that PHP will accept.
; http://php.net/post-max-size
post_max_size = 8M

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M

post_max_size specifies the maximum size of a POST, and since it has to be contained in memory, memory limit has to be bigger. The memory, will have to contain the running program and all the heap variables, including the POST.

If you increase only post_max_size over or near to the memory limit and forget to increase memory_limit, the POST size will be limited to a lower value when the memory is exhausted.

In this example you can see the default settings.

like image 2
stivlo Avatar answered Oct 25 '22 11:10

stivlo