Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase Max_input_vars limit for only one PHP page

Is there any way to increase the PHP max_input_vars limit for only one PHP page. I'm using a CSV upload and extract function. In which the csv data will be saved to the db using Insert query. But when i tried with larger CSV data such as about 9000 entries i got an error like this:

PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini.

I know we need to change the limit value in php.ini or .htaccess but i don't want to change the limit for the entire project for maintaing the security. So Is there any way to change it only for this functionality ??

like image 774
Zammuuz Avatar asked Oct 18 '22 05:10

Zammuuz


1 Answers

There's no way of doing that. You have to change it in the php.ini file, because not even ini_set can change it.

max_input_vars has a changeable mode of PHP_INI_PERDIR meaning it can't be changed using ini_set (only in php.ini, .htaccess or httpd.conf)

(Source)

You can, however, temporarily change that setting by adding this line to your .htaccess:

php_value max_input_vars 3000

(Source)

like image 191
Martin Avatar answered Oct 21 '22 05:10

Martin