Increase max_input_vars in php.ini WHM

markuswest

Active Member
Oct 21, 2013
30
0
6
cPanel Access Level
Root Administrator
Hi,

For one of my applications on a website I need to increase the "max_input_vars" in php.ini from the default 1000 to 9999 how can I do this one?

I wonder where and how should I configure this one on WHM or should I do it in the cPanel (cPanel of the website)
 

ITGabs

Well-Known Member
Jul 30, 2013
81
0
6
cPanel Access Level
Root Administrator
Hi,

This option should be in WHM -> Service Configuration -> PHP Configuration Editor -> advanced
But is not there

Workarounds...
You can try it adding this at the beginning of your script ini_set('max_input_vars', 9999);

or in the .htaccess

php_value max_input_vars 9999

or copy the main php.ini and add this line if you don't find max_input_time

max_input_time = 9999

the php.ini in Cpanel is on /usr/local/lib/php.ini
you can use
cp /usr/local/lib/php.ini /home/[cpuser]/public_html/php.ini
nano /usr/local/lib/php.ini

If you use Suhosin or Fast CGI you may need additional steps

for Suhosin:
php_value suhosin.get.max_vars
php_value suhosin.post.max_vars
php_value suhosin.request.max_vars

for mod fcgid
cat /usr/local/cpanel/cgi-sys/php5

and check this line:
[[ -f ~/public_html/php.ini ]] && exec /usr/bin/php -c ~/public_html/php.ini

so the account php.ini should be only in /home/[cpuser]/public_html/php.ini

There are other ways using .user.ini but I didn't see it working with Cpanel
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463
Hello :)

Check to make sure you are using PHP 5.3.9 or higher because the "max_input_vars" configuration value has only been available since that version of PHP. If you want to change the value for the entire server, modify /usr/local/lib/php.ini and then restart Apache.

Thank you.
 

MaraBlue

Well-Known Member
May 3, 2005
332
2
168
Carmichael, CA
cPanel Access Level
Root Administrator
Hello :)

Check to make sure you are using PHP 5.3.9 or higher because the "max_input_vars" configuration value has only been available since that version of PHP. If you want to change the value for the entire server, modify /usr/local/lib/php.ini and then restart Apache.

Thank you.
The line "max_input_vars = 5000" (or whatever value you want to change it to) will likely need to be added. The value is showing, but that line wasn't in my php.ini, v5.3.27.

# php -i | grep max_input_vars
max_input_vars => 5000 => 5000