Increase PHP post variable limits

In some cases, you will need to post a lot of variables. Under some circumstances, some server side or PHP settings will block you from sending too much variables over post data.

It is easy to overcome this. Just read on.

Determining the cause:

There are two ways PHP will block long and numerous post variables, suhosin security module and generic php.ini settings. In both the cases, you’d need to upload a file named phpinfo.php to your server with following code inside:

http://domain.com/phpinfo.php and search for (Simple Ctrl + F), suhosin. If you find something like

This server is protected with the Suhosin Patch 0.9.10

then your server has suhosin installed.

php-suhosin

 

Otherwise, it is limited by generic php.ini settings.

Solutions:

Depending on the cause, the solution will vary. But both of them require editing your php.ini file. Check this tutorial to learn how to.

Increasing suhosin variable:

Edit the following variables and put the values as given below:

suhosin.request.max_vars = 2048
suhosin.request.max_value_length = 1000000
suhosin.request.max_array_index_length = 256
suhosin.request.max_totalname_length = 8192
suhosin.post.max_vars = 2048
suhosin.post.max_array_index_length = 256
suhosin.post.max_totalname_length = 8192
suhosin.post.max_value_length = 1000000
suhosin.sql.bailout_on_error = Off
suhosin.log.file = 0
suhosin.log.phpscript = 0
suhosin.log.phpscript.is_safe = Off
suhosin.log.sapi = 0
suhosin.log.script = 0
suhosin.log.use-x-forwarded-for = Off

If you do not have access to your php.ini file, then you can try doing it by adding the following code to the .htaccess file on the root of your server.

<IfModule mod_php5.c>
	php_value suhosin.request.max_vars 2048
	php_value suhosin.request.max_value_length 1000000
	php_value suhosin.request.max_array_index_length 256
	php_value suhosin.request.max_totalname_length 8192
	php_value suhosin.post.max_vars 2048
	php_value suhosin.post.max_array_index_length 256
	php_value suhosin.post.max_totalname_length 8192
	php_value suhosin.post.max_value_length 1000000
	php_flag suhosin.sql.bailout_on_error Off
	php_value suhosin.log.file 0
	php_value suhosin.log.phpscript 0
	php_flag suhosin.log.phpscript.is_safe Off
	php_value suhosin.log.sapi 0
	php_value suhosin.log.script 0
	php_flag suhosin.log.use-x-forwarded-for Off
</IfModule>

Increasing generic php.ini value:

php-post-var-limit

Edit the following variable and put the value as given below

max_input_vars = 20480
post_max_size = 32M

If all of the methods fail, then you’d need to ask your web host. Sometimes, these variables are also blocked by server side firewalls.

Swashata has written 257 articles

Hi there, I am the Lead Developer at WPQuark.com. I love to create something beautiful for WordPress and here I write about how to use them. When I am not working, usually I am doing a number of other creative things ;).