Symptoms
When a domain needs to input a larger than standard variable amount through PHP, you may encounter a warning that you need to increase the PHP variable max_input_vars to a higher value. The error will look like similar to this:
"ERROR: Page is not saved.
You need to increase PHP variable max_input_vars to higher value.
Please contact your hosting provider.
And within the Apache error log /etc/apache2/logs/error_log
Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini.
Description
This value is by default set to 1000.
# grep max_input_vars /opt/cpanel/ea-php*/root/etc/php.ini
/opt/cpanel/ea-php53/root/etc/php.ini:max_input_vars = 1000
/opt/cpanel/ea-php56/root/etc/php.ini:max_input_vars = 1000
/opt/cpanel/ea-php71/root/etc/php.ini:max_input_vars = 1000
/opt/cpanel/ea-php72/root/etc/php.ini:max_input_vars = 1000
/opt/cpanel/ea-php73/root/etc/php.ini:max_input_vars = 1000
The use of this directive mitigates the possibility of denial of service attacks that use hash collisions. Sites with long pages, such as stores may encounter this.
Workaround
Start by increasing the values for your local files first as you do not want to increase this server-wide if you can avoid it.
For .htaccess
php_value max_input_vars 5000
For php.ini or .user.ini
max_input_vars =5000
For wp-config.php
@ini_set( 'max_input_vars' , 5000 );
This can be set via the Multi PHP INI Editor in cPanel, or the WHM.
cPanel >> Home >> Software >> MultiPHP INI Editor
WHM >> Software >> MultiPHP INI Editor for WHM
For the .htaccess, or wp-confi.php, please use either the command line and your favorite text editor such as vim/vi/pico, or utilize the File manager via cPanel >> Home >> Files >> File Manager to modify the file in question.
Comments
0 comments
Article is closed for comments.