PHP Max Input Vars variable max_input_vars was introduced in PHP as a security measure to limit the maximum number of POST variables sent. It represents the number of variables your server can use to run a function.
If you get the error “Increase PHP Max Input Vars Limit” in WordPress, you must increase the PHP max_input_vars value.
Table of Contents
This post explains how to change the maximum number of PHP script input variables for your web hosting account to meet specific application needs.
There are many different methods to increase PHP Max Input Vars in WordPress. However, this entirely depends on the hosting provider you are using.
Remember that you may not have specific permissions to increase the maximum PHP input variable limit. Therefore, contact your hosting provider beforehand and ask them to grant you the necessary permissions.
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.
Here we discuss of 3 options to increase the PHP Max Input Vars Limit by adding lines to the .htaccess file, php.ini, and done automatically from the PHP selector in cPanel
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:
- Once you’re inside, click on ‘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.
Option 2: Edit the .htaccess File
As a second and preferred option, you can set the max_input_vars
per application. Before making any changes to the file, ensure you get a backup of your site or at least of this file.
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:
- Once inside the File Manager, click on ‘Settings’ at the top-right corner, and then enable Show Hidden Files (dotfiles):
- 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:
- 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 3000If you are using Suhosin, add the following to the file instead:php_value suhosin.request.max_vars 2000
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.
php_value suhosin.post.max_vars 2000
Option 3: Edit the PHP.ini File.
The following method to increase the PHP max input vars limit in WordPress is editing the php.ini file. Follow the Same steps as shared above on Edit the .htaccess File
This file is also in the root directory of your host, where you have installed WordPress.
If you can’t find it, create a new empty php.ini file.
In either case, open the file in an editor and add the following code to it:
max_input_vars = 5000
Don’t forget to save the changes and reboot your server once to use the newly added data.
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.