How to Change the Maximum Number of Input Variables for PHP Scripts?

How to Change the Maximum Number of Input Variables for PHP Scripts?

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:
  1. max_input_vars = 2000
That’s it. You have changed the maximum input variable using max_input_vars directive.

Note

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.

    • Related Articles

    • How to change PHP version?

      Magento is an open-source platform, built on PHP. If you like to change the PHP version of your Magento site, you can do it with the Breeze platform. Before changing the PHP version, please understand the requirements of your site. Not all PHP ...
    • How to restart PHP?

      You can restart the PHP of the site manually, in case the website starts showing any PHP-related error. Most of the time, our system restarts the PHP automatically after detecting the issue. The system adds the process to the logs. However, if you ...
    • How to change SFTP password?

      SFTP (SSH File Transfer Protocol) is a secure file transfer protocol. It runs over the SSH protocol. It supports the full security and authentication functionality of SSH. If you like to change the website’s SFTP password, you can do it right from ...
    • How to change Magento admin URL?

      The default Magento admin URL is http://mgentoStore.com/admin. You can change the default Magento admin URL from the Magento admin panel or by using server sides commands. With Breeze, you can change the Magento admin URL right from the platform. ...
    • How to change or set new primary domain name?

      The primary domain is the domain name you use while creating the account and setting up the server. It works as an identifier and represents your account. You can set a new domain as a primary domain at any time.  How to set a new primary domain ...

    Ready your Magento Store for Core Web Vitals.