Php ini max input vars

Backdrop will try to adjust PHP's max_input_vars setting automatically through a setting in it's default .htaccess file. If Backdrop is not able to make this change automatically, you may need to change it yourself.

When this value is set too low, PHP's max_input_vars setting can cause silent failures on large forms. This problem is known to commonly happen if:

  • you have more than 3 user roles, and a lot of modules (when updating permissions)
  • you have a lot of user roles (when updating permissions)
  • you have a lot of taxonomy terms in one vocabulary (when reordering terms)
  • you have a lot of menu links in one menu (when reordering menu links)
  • you have a lot of fields on a node (when saving the node)
  • you have a lot of values in a multi-value or paragraphs field (when saving the node)

Trivia: Why 10007 you ask? A value such as 10000 may be a common number used elsewhere in code. By setting it to 10007, you can easily search for it, to locate where the setting needs to be updated.

How to set the value in php.ini

If you have access to the php.ini file on your server, you can set the max_input_vars value, as follows:

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 10007

How to set the value in .htaccess

  • Find your project's .htaccess file
  • Open it, and add the following line

    php_value max_input_vars 1000

  • Change the 1000 value to 10007.
  • Save the file.
  • No restart is required

How to set the value in httpd.conf

  • Locate the httpd.conf file within the apache configuration folder (usually under /conf subdirectory.
  • Open it, and go to the end of the file. Add the code below*

    <IfModule mod_php7.c>
    php_value max_input_vars 10007
    </IfModule>


    * You may need to change mod_php7.c to match your version of PHP. Use mod_php5.c for PHP 5, for example.
  • Save the file.
  • Restart Apache and the configuration will be applied.

Note: you cannot set this value in settings.php

Some php configuration settings can be set in your site's settings.php file. Unfortunately, max_input_vars is not one of them.

You can't override it here because it is in the PHP_INI_PERDIR group. Configuration settings in this group can only be set in php.ini, .htaccess, httpd.conf or .user.ini.

See The PHP documentation on all PHP_INI_* modes.

PHP Max Input Vars error is one of the most common errors in any WordPress site. Probably faced while importing theme demo, executing a large file, etc.

To fix this, you need to increase PHP Max Input Vars in your WordPress site.

Table of Contents

  • Increase PHP Max Input Vars: 3 Methods
  • WP Reset
    • What is PHP Max Input Vars
    • How to Check the PHP max input vars?
    • 1. How to Increase PHP Max Input Vars using wp-config.php
    • 2. How to Increase PHP Max Input Vars using .htaccess
    • 3. How to Increase PHP Max Input Vars using php.ini
    • You’re still having a problem?

So in this article, I’ll help you to fix this error.

We are covering 3 methods:

  • Using wp-config.php
  • Through .htaccess
  • And php.ini

But before that, you should check out what’s your actual Input Vars.

Note: Make sure you have a complete site backup or selected file that we gonna edit just in case something goes wrong.

WP Reset

If you don’t know where or how to backup your site, check out WP Reset, a tool that not only backs up your website but helps in maintaining, developing, and debugging it.

Php ini max input vars

WP Reset’s most important feature and the most valuable one, in this case, is the Snapshots feature. So, whenever you are making a major change on your website, it’s a very good idea to take a snapshot of the website prior to the change. Thus, if the change wasn’t good or you just don’t like what happened, you can easily revert to the previous state by choosing the correct snapshot.

Php ini max input vars

Moreover, this tool ensures you have all the cleaning and recovery tools at your disposal. You don’t have to worry about not being able to access your WordPress or encountering the white screen of death. With just one click, you can clean up your site and start with a clean slate. Similarly, if you want to install new plugins and themes, you can do so with one click. There’s no more tedious work of installing each plugin manually.

In addition, snapshots and plugin collections can be safely stored in the cloud or you can use one of the major services, such as Dropbox. Finally, when you really mess up and don’t know what to do, simply use the Nuclear Reset option and erase all options, files, database entries, and tables.

What is PHP Max Input Vars

The PHP Max Input Vars is the maximum number of variables your server can use for a single function.

In other words, when you’re saving amounts of data, nothing happens. It means you need to increase max_input_vars in your host to be able to use the maximum potential.

How to Check the PHP max input vars?

The best way to check it is to create a PHP file on your server like php-info.php (you can name anything) and put the following code in it.

<?php phpinfo(); ?> 

Once you put the code, upload it on your server’s public_html directory. You can access it using FTP client software or File Manager in your cPanel.

Php ini max input vars
Now open this file in your browser, to open it write down your domain and file name like this domain.com/php-info.php. There you will see a table list containing all configuration info about your current PHP environment.

However, this is not recommended as having this file on your site leaves you vulnerable to hackers.

In case, you weren’t able to see there. You can even check-in system status page that comes in the theme like Avada, Newspaper, Jannah.

Php ini max input vars
Checking PHP Max Input Vars

Or you can install Server IP & Memory Usage Display to know the current PHP Max Input Vars and view the current memory usage and the PHP version you are using in the dashboard and admin footer.


Once you know your input vars stats, you can now decide how much max input your site needed and that’s the whole point to check Max Input Vars of your site.

1. How to Increase PHP Max Input Vars using wp-config.php

This the most likable method people like to use. To do this, you need to edit the wp-config.php file on your WordPress site as it located in your WordPress site’s root folder.

Once you open this file in a text editor, paste below code in the wp-config.php file just before the line says ‘That’s all, stop editing! Happy blogging.’

@ini_set( 'max_input_vars' , 2000;

Next, save your changes and upload the wp-config.php file back to your server. And this code tells the server to increase the PHP Max Input Vars to 2000.

Php ini max input vars
Increase the max-input-vars using wp-config.php

Now, refresh your site to see if the error is gone. If the error keeps coming, try to allocate more variables. The maximum recommended limit is 4000 for a normal site.


2. How to Increase PHP Max Input Vars using .htaccess

If you’re not comfortable with wp-config.php, no worry you can do this via .htaccess too.

Your .htaccess file starts with a dot because it is a hidden file. So if you don’t see it in your root folder, make sure that your file manager isn’t keeping those files hidden from view.

Php ini max input vars
Check show hidden files

Once you found, open the file in a text editor and add below code to your .htaccess file:

php_value max_input_vars 2000

Next, save your changes and upload it to your root directory. Refresh your site to see if the error is gone. If this doesn’t work, then you need to contact server administrators.

Read more:

  • How to Increase PHP Time Limit
  • How to Increase PHP Memory limit

3. How to Increase PHP Max Input Vars using php.ini

Php.ini is one of the essential configuration files in PHP. It is used to control variables such as memory size, max upload size, max time for execution, upload directory, display errors, log errors,  etc.

To increase input vars size, you need to find this file in your server. You’ll most likely find it in the root folder, but the location of the file will vary by host.

There is one simple way to find out exactly where the php.ini configuration file located. As I mentioned earlier how to check PHP max input vars. Same as that you need to create a PHP file and add following code in it.

 
<?php phpinfo(); ?> 

And you can able to check php.ini file location just by opening this PHP file in your browser.

Php ini max input vars
php.ini file location

Once you find php.ini or php5.ini file, open it in a text editor and paste the following code in it to increase input vars:

max_input_vars = 2000

Next, save your changes and upload back to your server.

Php ini max input vars
Increase PHP max input vars using php.ini file

Or in case if you aren’t able to find. Just Create one as php.ini by any text editor, paste exact code max_input_vars = 2000 and upload it in your root directory.

You’re still having a problem?

If these solutions does not work for you, then this means your web hosting service provider does not allow WordPress to increase PHP max input vars.

You will need to ask your web hosting provider to increase your PHP max input vars manually.

Sometimes your hosting limits the number of input vars to use especially shared hosts. Even, many shared hosting providers don’t even give you access to your php.ini file.

In these cases, it may be time to upgrade your hosting setup to WordPress hostings.

How do you increase the maximum input vars limit?

How to Increase the Max Input Vars Limit.
In your WordPress root installation locate any of these .htaccess , php.ini , .user.ini or wp-config.php..
Edit the file and paste the directive code..
Once you are done making changes save the file..

What is Max input VAR?

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'.

How do you fix PHP setting max_input_vars must be at least 5000?

If you created your own PHP. ini file, then add the same code inside it: max_input_vars = 5000 Simply change the value to the recommended value. For example, 5000. Save your changes, and reboot your localhost or your server.

How do I change the PHP input vars limit in WordPress?

ini file in the root folder of your WordPress installation. If you find your existing PHP. ini, open the file and locate the following line of code (xx represents a number): max_input_vars = xx ; And set it to your desired limit. For example, 3000.