5

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.

Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
  • 2
    Are you running `suhosin`? In that case. look at the `suhosin.post.*` settings, especially `suhosin.post.max_value_length` (and perhaps let it log these kind of errors...) – Wrikken Jul 04 '12 at 17:27
  • @Wrikken: I do not think so, the name doesn't ring a bell (I didn't set this server up). – Violet Giraffe Jul 04 '12 at 17:45
  • Think or know? `phpinfo();` is close at thand to be sure... – Wrikken Jul 04 '12 at 17:47
  • @Wrikken: It must be it. The server does indeed have Suhosin. The default limit was 1M, and that's exactly the maximum I could send. However, I've set both `suhosin.request.max_value_length` and `suhosin.request.max_value_length` to 64M, but no change in behaviour. Still can't pull long variable through. – Violet Giraffe Jul 05 '12 at 08:23
  • 1
    Although `suhosin.post.max_value_length` cannot be _higher_ then `suhosin.request.max_value_length`, it can be lower... I'd examine all `suhosin.request.*` & `suhosin.post.*` variables and set them to sane amounts, and of course, if you can, make suhosin's log available to debug. And keep in mind it needs to be set _before_ ending up in PHP, so, at host-configuration or `.htaccess`, not inline in PHP. – Wrikken Jul 05 '12 at 08:33
  • @Wrikken: sorry, I made a mistake in my commentary, please see the updated question with current settings. And it's all set in php.ini – Violet Giraffe Jul 05 '12 at 08:41

4 Answers4

1

Try to up :

  • post_max_size
  • upload_max_filesize
  • memory_limit
Clément Andraud
  • 9,103
  • 25
  • 80
  • 158
1

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

Community
  • 1
  • 1
1

I added:

suhosin.post.max_value_length = 64000000 suhosin.request.max_value_length = 64000000

In the suhosin.ini and it worked.

Settings in php.ini:

upload_max_filesize = 64M memory_limit = 128M post_max_size = 128M

ridcully
  • 294
  • 1
  • 9
0

Had to disable Suhosin. Still not sure which setting is responsible since the ones I've specified in the question didn't help.

Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335