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:

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

[text]This server is protected with the Suhosin Patch 0.9.10[/text]

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:

[text]
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
[/text]

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.

[text]
<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>
[/text]

Increasing generic php.ini value:

php-post-var-limit

Edit the following variable and put the value as given below

[text]max_input_vars = 20480
post_max_size = 32M[/text]

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 ;).

7 thoughts on “Increase PHP post variable limits

  1. capacitate says:

    Tried Netfirms, Hostgator and Alibaba host.. None of them supports more then 1000. Although alibaba host has set 2048, But still the plugin doesnt work properly. I am in a loss with no resolution.

  2. roybato says:

    Sir, i have the same problem but my concern is the support above is confusing for a non programer like me. Is there a more easy way to do this?

  3. Pearl Dency says:

    I am editing my php.ini

    Resource Limits ;
    max_execution_time = 180
    max_input_time = 120
    max_input_vars = 20480
    memory_limit = 1024M

    And takes no effect. I added the code on .htaccess.

    Am I missing something sir?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.