HoganHost blog

[email protected]

How to Increase max_input_vars on a CloudLinux Server Using SSH

 

How to Increase max_input_vars on a CloudLinux Server Using SSH

If you’re running a website or application that requires processing a large number of input fields, such as WHMCS or WordPress, you may need to increase the max_input_vars setting in PHP. This guide will show you how to adjust the max_input_vars value on a CloudLinux server using SSH.

What is max_input_vars?

max_input_vars is a PHP configuration setting that controls the maximum number of input variables (such as form fields) that PHP will accept. If you have large forms or settings pages that submit a lot of data, you may encounter errors if this limit is too low. By default, max_input_vars is set to 1000, but you may need to increase it for certain applications.

Prerequisites

  • SSH access to your CloudLinux server.
  • A basic understanding of how to use the command line and edit files with nano or another text editor.

Steps to Increase max_input_vars Using SSH

  1. Log in to Your Server via SSH:Open your SSH client (such as PuTTY or Terminal) and connect to your CloudLinux server using your SSH credentials.

    ssh username@your-server-ip

    Replace username with your actual SSH username and your-server-ip with your server’s IP address.

  2. Edit the PHP Configuration File:Once logged in, you need to edit the PHP Selector configuration file to increase max_input_vars.

    Use the nano command to open the configuration file located at /etc/cl.selector/php.conf:

    sudo nano /etc/cl.selector/php.conf

  3. Add the max_input_vars Directive:In the php.conf file, you need to add the directive for max_input_vars. Scroll down or use the arrow keys to navigate to the appropriate section where you can add new PHP directives.

    Add the following lines:

    Directive = max_input_vars
    Type = list
    Range = 1G,9G

    This configuration sets the directive for max_input_vars, specifying it as a list type with a range from 1G to 9G.

  4. Save and Exit the Editor:After adding the above lines, save the changes by pressing Ctrl + O (then press Enter to confirm), and then press Ctrl + X to exit the nano editor.
  5. Verify Your Changes in cPanel:After editing the configuration file, the changes should take effect immediately. To verify this, log in to your cPanel account:
    • Navigate to Select PHP Version under the Software section.
    • Click on the Options tab.
    • You should now see max_input_vars listed as an option on the page.
    • Adjust the value as needed, up to the maximum limit specified (9000 in this case).

Final Thoughts

By following these steps, you have successfully increased the max_input_vars setting on your CloudLinux server. This change will allow your applications to handle more input variables, helping to prevent errors when dealing with large forms or settings.

If you encounter any issues or need further assistance, please consult your hosting provider or server administrator for support.

Additional Tips

  • Backup Configuration Files: Always make a backup of any configuration files before editing them. This way, you can quickly restore the previous settings if anything goes wrong.
  • Test Your Changes: After making changes to server configurations, always test your website or application to ensure that everything is functioning as expected.
  • Consult Documentation: For more detailed information about PHP configuration settings, consult the PHP documentation or your hosting provider’s support resources.

By following this guide, you can efficiently manage your server’s PHP settings and ensure your web applications run smoothly.

Check out our cheap and reliable web hosting 

Leave a Comment

Your email address will not be published. Required fields are marked *