一尘不染

PHP警告:113字节的POST内容长度超出了-1988100096字节的限制(未知)

php

用户在我的网站上上传图片时遇到了很多问题。

他们最多可以上传6张图片

最初,我不得不将php.ini中的值更改为:

upload_max_filesize = 2000M
post_max_size = 2000M
max_execution_time = 120
max_file_uploads = 7
memory_limit=128M

我不得不更改为这个,因为出现了各种错误,例如内存不足,超出最大发布数等。

一切正常,直到我检查了包含以下内容的错误日志:

[11-Jun-2011 04:33:06] PHP Warning:  Unknown: POST Content-Length of 113 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0
[11-Jun-2011 04:33:12] PHP Warning:  Unknown: POST Content-Length of 75 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0
[11-Jun-2011 04:33:27] PHP Warning:  Unknown: POST Content-Length of 74 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0
[11-Jun-2011 04:33:34] PHP Warning:  Unknown: POST Content-Length of 75 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0
[11-Jun-2011 04:33:43] PHP Warning:  Unknown: POST Content-Length of 77 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0
[11-Jun-2011 04:33:48] PHP Warning:  Unknown: POST Content-Length of 74 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0
[11-Jun-2011 04:33:53] PHP Warning:  Unknown: POST Content-Length of 75 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0
[11-Jun-2011 04:34:20] PHP Warning:  Unknown: POST Content-Length of 133 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0
[11-Jun-2011 04:35:29] PHP Warning:  Unknown: POST Content-Length of 131 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0
[11-Jun-2011 04:36:00] PHP Warning:  Unknown: POST Content-Length of 113 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0
[11-Jun-2011 04:36:06] PHP Warning:  Unknown: POST Content-Length of 75 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0
[11-Jun-2011 04:36:34] PHP Warning:  Unknown: POST Content-Length of 116 bytes exceeds the limit of -1988100096 bytes in Unknown on line 0

如果我将帖子的最大值改回前8M,则会收到如下消息:

PHP警告:11933650字节的POST内容长度超出了第0行中Unknown中的8388608字节的限制

有什么想法我要去哪里吗?


阅读 299

收藏
2020-05-29

共1个答案

一尘不染

在某些32位系统上,PHP将采用类似2000M或的内存设置,2G并且通过不执行边界检查将其转换为整数字节。一些起始于2G2048M-2147483648字节然后。

一些PHP版本将其设置在顶部,因此它不会变成负数(即32位有符号整数限制)。

如果要在这样的系统上实现最大可能的字节数,请使用 2147483647 。这等于两个千兆字节减去一个字节。

另外,如果您需要处理大数据,请考虑使用64位系统。

另外,您应该考虑以下几点:

根据PHP手册,该memory_limit设置更为重要。如果没有提供足够的内存,则将通过后数据大小检查,但是PHP将没有足够的内存来实际处理后数据。您将收到另一个错误,那就是内存已超出。因此,在配置PHP时,请注意post_max_size小于memory_limit

在您的示例中,memory_limitis是128M,因此它无法处理大小大于〜128 MB的后数据。

2020-05-29