In this knowledgebase, we will learn to change the maximum number of input variables allowed for PHP scripts by using the max_input_vars directive in a php.ini file. If you have already set up a custom php.ini file, you can skip step 1.
Step 1: Setting up the Custom php.ini file
Php.ini files contain instructions to control many PHP settings. You can set up as many php.ini files as you like to define the website functions. But it is recommended to only have one php.ini file per directory. You can have one php.ini file in the public_html directory to control the website’s homepage, while a different one in the public_html/images directory to look over the web site’s image files.
Follow this steps to set up custom php.ini file:
1. Log in to cPanel or hosting panel
2. Open the File Manager to navigate to the directory where you want to modify the behavior of php. By default, a custom php.ini affects only the directory where it is located.
3. Click the plus button or File button in the File Manager toolbar to create a new file. Name it php.in.
4. Click on the new file and then click the Edit button to edit the new php.ini file we just created.
5. Add php directives to the new php.ini and then click the Save Changes button.
6. Once you create the php.ini file and set its permissions, verify if the configuration is active. To verify the activation, create a phpinfo file 7. in the same directory as php.ini file.
8. Load the phpinfo file in the web browser, and locate one of the directives you added to the php.ini file. Ensure the changes are there.
That’s it. A new php.ini file is created.
Step 2: Using the max_input_vars directive
The default value of the maximum number of input variables allowed for PHP scripts is set to 1000. The PHP obtains the input variables from HTML forms and cookies enables pages. Sometimes the number of input variables is higher than usual.
If you want to change the maximum number of input variables for PHP scripts, add the max_input_variables into your php.ini file. And set the maximum number of input variables to 2000.
Simply add this line to the php.ini file:
That’s it. You have changed the maximum input variable using max_input_vars directive.
If you do not know what you are doing, please feel free to ask your hosting team to do this. Working with server configuration and php files could break your Magento store. Before doing any changes, please take a complete backup of your store.