没有不值得去解决的问题,也没有不值得去学习的技术!

Resolving the “mb_parse_str(): Input variables exceeded 1000” Error in PHP 7.2

Under PHP 7.2, an error occurs: mb_parse_str(): Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini.

1. The number of request parameters is 1136, as shown in Figure 1.

The number of request parameters is 1136
Figure 1

2. Under PHP 7.2, an error occurs: mb_parse_str(): Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. As shown in Figure 2.

Under PHP 7.2, an error occurs: mb_parse_str(): Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini.
Figure 2

3. max_input_vars indicates how many input variables are accepted (the limit is applied separately to the $_GET, $_POST, and $_COOKIE superglobals). The use of this directive mitigates the possibility of denial-of-service attacks using hash collisions. If the number of input variables exceeds the number specified by the directive, an E_WARNING is generated, and further input variables are truncated from the request. Edit C:\php-7.2.14\php.ini and set its value to 10000.

INI

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

4. Restart the PHP process and make the request again. An error occurs: Maximum execution time of 30 seconds exceeded, as shown in Figure 3.

Restart the PHP process, make the request again, and an error occurs: Maximum execution time of 30 seconds exceeded
Figure 3

5. max_execution_time indicates the maximum execution time allowed for a script before it is terminated by the parser, measured in seconds. This helps prevent poorly written scripts from exhausting server resources. The default is set to 30. When running PHP from the command line, the default is set to 0. Edit C:\php-7.2.14\php.ini and set its value to 300.

INI

; max_execution_time = 30
max_execution_time = 300

6. Restart the PHP process and make the request again. It responds successfully, as shown in Figure 4.

Restart the PHP process, make the request again, and it responds successfully
Figure 4

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系