7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【PHP】Input variables exceeded 1000. の対処法

Last updated at Posted at 2016-09-26

問題

PHPで無邪気に大量のPOSTを行っていると下記のようなWarningが表示されることがあります。

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

PHP 5.3.9 以降でフォームから1000件以上のデータをリクエストする(GET/POST/COOKIE)と、勝手にデータを1000件に制限されるのです。
これはDoS攻撃に対する予防線の模様。
参照 PHP/max_input_vars

傾向と対策

php.iniを編集します。

$ vi /etc/php.ini
/etc/php.ini
; 402行目辺りに下記パラメータがあるのでこれをコメントインして任意の値に変更します
;行番号が出てなければ :set number してください
;もしくは /max_input_vars で検索検索ゥ!

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 2000

下記コマンドで php-fpmを再起動!

$ sudo service php-fpm restart

光あれ。

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?