Increase max_input_vars value in php.ini file in Web Server
A few days back when i was migrating my WordPress Blog to a new theme i face a weird problem that i was not able to save new themes settings as the saving wheel keeps spinning, i searched a lot about this problem and found one solution that this was due to my max_input_vars value in php.ini (PHP configuration file) is low which was 1000 and for WordPress to run perfectly it needs to be atleast 2000.
Many of Webhost providers already provide their hosting with suitable value of max_input_vars but as i was using a self owned Virtual Private Server with self installed OS and WordPress this was not the case with me.
So, i’m sharing this tutorial to increase the max_vars_value in php.ini file. I’m using a VPS with no CPanel running on Ubuntu 14.04 and with a fresh installed LAMP Server (Linux, Apache, MySQL, PHP).
What is Max Input Vars value?
It limits the number of input variables, this limit affects $_GET, $_POST and $_COOKIE superglobal separately, If you are using any dynamic site in your host like WordPress then you will surely face this problem.
Note : The Solution also works when you face a problem like below:
Warning: parse_str() [function.parse-str]: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in/home/user/public_html/path/t0/file/causing/this/error.php on line 459
How to increase max_input _vars value in php.ini file in Ubuntu?
Step 1 : So, first of all you need to have root access of your Server with FTP.
Step 2 : To increase max_input_vars value first we need to find the php.ini file.
Step 3 : As i’m using Ubuntu with FTP access via FileZilla this file was present in php5 folder inside etc folder, the correct structure to that file is /etc/php5/php.ini.
Step 5 : Now edit that file with either Notepad or i would recommend Notepad++.
Step 6 : Next search for phrase max_input_vars in php.ini file, in my case this phrase was present on line 402, you will see that its been commented out so just remove the ‘#’ hash sign from front of that line and change that value to your desired preference, if you are using WordPress then i would recommend changing that value to 2000 (See below image for reference).
Step 7 : Save the file and upload it to same directory.
Step 8 : Now to make the changes occur you need to restart your apache server, you can do this by either restarting your whole server or by entering the below command in via terminal ssh.
sudo service apache2 restart
Step 9 : To make sure that the changes have been done you need to create a php file in public_html directory, create a file with any name say info.php and add the following into it
<?php phpinfo(); ?>
and save it, now open your browser and type http://your-address.com/info.php, now search for phrase max_input_vars and you will see that you value have been updated.
Method 2 (For Godaddy WebHosting Users):
In your site root (commonly the public_html folder) you must create the php.ini file and add the following lines to it:
max_input_vars = 5000
suhosin.post.max_vars = 5000
suhosin.request.max_vars = 5000
[alert variation=”alert-info” dismiss=”dismiss”]Get $10 Referral Amount When you a Purchase a VPS from Digital Ocean using below button
Get $10 in Digital Ocean for Free[/alert]
That’s it, now your problem of max_input_vars has been solved, if you face any problem doing thsis then feel free to comment below and also share your reviews about this tutorial.
Don’t forget to subscribe to our mailing list for more tutorials like this.