setting max_input_vars PHP.ini directive using ini_set

北城以北 提交于 2019-11-27 03:46:50

问题


Can I set the max_input_vars PHP.ini directive in my code? I have it set at the default 1000, however I have a script that has many checkboxes and text fields that could, and quite possibly will, go over the 1000 limit.

I'm using PHP 5.3.10 and i'm not getting any errors doing this. Also, I can't find any documentation that states I can't do this.

ini_set('max_input_vars', 3000);

Thanks.


回答1:


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)




回答2:


I know many people avoid accessing php.ini due to one reason or the other. so another way would be to create a .htaccess file in the operation folder and add the following codes and set the values to a higher value. Just add them directly no need to initialize anything in the .htaccess file

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

This solution worked for me without accessing the php.ini file. since some of the web host providers give us a hard time when we want to access the php.ini file



来源:https://stackoverflow.com/questions/9973555/setting-max-input-vars-php-ini-directive-using-ini-set

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!