Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Long POST data is discarded by Suhosin, what settings may be responsible?

Tags:

post

php

apache

I have an Apache server running a PHP script that receives data via a POST request that has several fields. One of the fields may be very long, and when it reaches somewhere between 512 kB and 1 MB it's discarded, i. e. the received POST does not contain this field at all, but other fields are present and OK.

Here are the current relevant settings in php.ini:

upload_max_filesize = 64M
memory_limit = 128M
post_max_size = 128M
suhosin.post.max_value_length = 64000000
suhosin.request.max_value_length = 64000000

I'm trying to send 1024 * 1024 symbols in a single POST variable, and this variable is still discarded.

P. S. Can't find how to get Suhosin's log.

Update: I have disabled Suhosin by specifying suhosin.simulation = On and now long data successfuly makes it to my PHP script. The problem is I don't want to disable Suhosin completely, I only need to tune the limit.

like image 857
Violet Giraffe Avatar asked Oct 23 '22 17:10

Violet Giraffe


2 Answers

Try to up :

  • post_max_size
  • upload_max_filesize
  • memory_limit
like image 120
Clément Andraud Avatar answered Oct 31 '22 09:10

Clément Andraud


lightster's answer here How to increase maximum POST variable in PHP? helped me when suhosin configs didn't:

"PHP 5.3.9 introduced the max_input_vars config option, which is defaulted to a value of 1000. Check out the Runtime Configuration section of the PHP manual. The default value and the change log are at the top of the page.

The value can be changed by updating the server's php.ini, adding an .htaccess file, or adding a line to httpd.conf."

I set it in .htaccess:

php_value max_input_vars 2000

like image 21
Pål de Vibe Avatar answered Oct 31 '22 10:10

Pål de Vibe