user2723490
user2723490

Reputation: 2100

PHP $_POST limit

I send a JSON array from jscript to PHP via jQuery $.post(). It is a table of numbers of 3-4 digits and its size is 174 x 15 (rows x cols). When checking the XHR Post. I can see all values like

pdata[0][]  dates
pdata[0][]  Fund B1
pdata[0][]  Fund B2
pdata[0][]  Fund B3
pdata[0][]  Fund B4
pdata[0][]  Fund B5
pdata[0][]  Fund B6
pdata[0][]  Fund B7
pdata[0][]  Fund B8
pdata[0][]  Fund B9
pdata[0][]  Fund B10
pdata[0][]  Fund B11
pdata[0][]  Fund b12
pdata[0][]  Fund B13
pdata[100][]    4/30/2005
pdata[100][]    -3.16%
pdata[100][]    -3.54%
pdata[100][]    -0.52%

Note that the 1st index is sorted alphabetically, not numerically. Then I process that array in PHP as

$pdata  = $_POST['pdata']; 
print_r($pdata);

The problem is that about half of data is missing and $pdata has only about 72 elements (arrays) instead of 174. I was thinking that it is related to the PHP post_max_size and increased it to 30Mb, but it didn't help.

What else could truncate an array?

Thanks.

Upvotes: 0

Views: 495

Answers (4)

Smile
Smile

Reputation: 2758

I would like to suggest you increase the values for following in php.ini

post_max_size = 200M
upload_max_filesize = 200M

You can set the value which is suitable to your needs.

Note: Server Restart is necessary after changing the settings in php.ini.

Upvotes: 0

Joe
Joe

Reputation: 61

I had the same problem, to fix it I added this line to my htaccess file.

php_value max_input_vars 15000

You can change the 15000 value to whatever is suitable for your need.

Upvotes: 1

softsdev
softsdev

Reputation: 1509

increase

suhosin.post.max_vars = 2048
suhosin.request.max_vars = 2048

on php.ini and restart server

also you can add this to your .htaccess file( no need to restart server in this condition ) but for that you have to check is

suhosin.perdir = "p"

is set on php.ini

you can check php.ini config default variables using

 phpinfo();

Upvotes: 0

zerkms
zerkms

Reputation: 254886

max_input_vars is the directive you're looking for.

By default it's 1000, which matches to your observations ("about 72 elements" => something like 71x14 + 6).

Upvotes: 1

Related Questions