Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding max_input_vars 3000 to my .htaccess file and php.ini not working

Tags:

php

.htaccess

I've done some searching and seems everything I've read and tried with adding max_input_vars 3000 to my .htaccess and php.ini is not working. I've reached the limit on custom fields and can't get the max increased. I added these lines and restarted apache but nothing helps.

Here is what I added to .htaccess:

php_value max_input_vars 3000
php_value suhosin.get.max_vars 3000
php_value suhosin.post.max_vars 3000
php_value suhosin.request.max_vars 3000

And here is my php.ini:

max_input_vars 3000
suhosin.get.max_vars 3000
suhosin.post.max_vars 3000
suhosin.request.max_vars 3000
like image 332
tjoenz Avatar asked Sep 06 '25 13:09

tjoenz


2 Answers

You can change your max_input_vars value to 2000 or any value that you want in htaccess by adding this for PHP 7.*:

<IfModule mod_php7.c>
    php_value max_input_vars 2000
</IfModule>

And for PHP 8.* use this:

<IfModule mod_php8.c>
    php_value max_input_vars 2000
</IfModule>
like image 129
Pejman Kheyri Avatar answered Sep 09 '25 09:09

Pejman Kheyri


Repost from: [https://stackoverflow.com/a/29312220/3827361][1]

I had the same issue, and I fixed it by setting max_input_vars value in this php.ini: /etc/php5/apache2/php.ini

even though php_info() reported a different php.ini used (/etc/php5/cli/php.ini). BTW, before I stumbled upon the solution, I also tried setting up the value in .htaccess (in the web page root directory), with no effect.

This looks like a possible bug in PHP 5.5. In any case, I suggest locating all php.ini files on your server ("locate php.ini") and setting max_input_vars in all of them (or the first one that works, eh). Don't forget to restart Apache so this takes effect (sudo /etc/init.d/apache2 restart)

BTW, my PHP Version is 5.5.9-1ubuntu4.5, installed on Ubuntu 14.04.

like image 28
Shalabajzer Avatar answered Sep 09 '25 10:09

Shalabajzer