HostAdvice Special Deals! Save 75% on all Shared Hosting Plans & Locations

Cyber Week Special Offers! Save 70% on all Shared Hosting Plans & Locations - Starting from $2.95/mo

How to Set the max_input_vars Directive for Your Entire Hosting Account

Updated on Oct 14, 2021

The PHP variable max_input_vars was introduced in PHP 5.3.9+ as a security measure to limit the maximum amount of POST variables submitted. It represents the number of variables your server can use to run a function. If the value of PHP input vars is not enough, you will get the max_input_vars error.

To resolve this, the default value can be increased. In this post, we will discuss all the possibilities in cPanel and explain how to change the maximum number of input variables allowed for PHP scripts for your entire web hosting account in order to fit specific application requirements. 

What is the PHP Input Vars?

Before we dive into the methods to increase PHP Max Input Vars, let us cover what exactly is PHP Input Vars. The Max Input Var value represents how many variables for a single function your server can use to avoid overloads. Depending on your script or website, you may need to change this value.

Although the default value for max_input_vars is usually enough, you may receive the error ‘Increase PHP Max Input Vars Limit’. The limit can easily be reached if the PHP developer has created a bulk editing/processing functionality.

This error can cause a lot of issues on your website's performance, as well as cause issues with your Plugins or Theme. For example, you may lose all of your data in your theme options or the template you are using may lose its functionality. In addition, the activated widgets on your website may disappear.

Note: This issue was addressed in WordPress 4.5 and above. If you’re not running the latest version of WordPress, we highly recommend upgrading instead of performing the described changes below.

How to Increase PHP Max Input Vars Limit?

There are many different methods to increase the PHP Max Input Vars. Setting the limit for the input variables can be done both automatically from the PHP selector in cPanel, or by using the File Manager or an FTP client and editing the .htaccess file.

Option 1: Use the “Select PHP Version” Tool in cPanel

This is the easiest method for setting the limit of input variables for your entire hosting account. All you have to do is:

  • Log into your cPanel;
  • Find and click on the 'Select PHP Version' under the 'Software' section:

Find Select PHP Version in cPanel

  • Once you’re inside, click on 'Switch to PHP Options':

Switch to PHP Options

  • After switching, scroll down and you will see the max_input_vars with a drop-down right beside it. Use the drop-down to set your desired limit.

Set Max Input Vars

Option 2: Edit the .htaccess File

As a second and preferred option, you can set the max_input_vars per application. In this example, we will use the cPanel File Manager, but you can do it via an FTP Client like FileZilla as well. Follow these steps:

  • Log into your cPanel;
  • Locate File Manager, which is under the ‘Files’ section:

Locate File Manager in cPanel

  • Once inside the File Manager, click on ‘Settings’ at the top-right corner, and then enable Show Hidden Files (dotfiles):

Check Show Hidden Files in cPanel

  • After you do that, locate the .htaccess file of your desired application.
  • Select the .htaccess file, and click the right mouse button over it. Select ‘Edit’, and after you get a pop-up window, click on the button ‘Edit’ again to confirm:

Click Edit on Htaccess Via File Manager

  • Once inside the .htaccess file, you need to add the following line at the end or beginning of the file:

    php_value max_input_vars 3000
    Where 3000 stands for your variable limit, and it should be what the specific application is requiring. If it’s WordPress, 3000 should be enough for any occasion.

Conclusion

The max_input_vars variable should be as lowest as possible as if it is greater one it opens the door to abusive behavior mostly with DDoS attacks hash collisions. This is the reason why we keep that variable lower on all our shared hosting plans.

If you are getting the same error message and the suggested fix does not resolve the issue for you please contact our technical support team as they will investigate and surely resolve this issue for you.

We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!

SSD Cloud Hosting

  • Free Domain Transfer
  • 24/7 Technical Support
  • Fast SSD Storage
  • Hack-free Protection
  • Free Script Installation
  • Free Website Transfer
  • Free Cloudflare CDN
  • Immediate Activation
View More