PHP 警告:113 字节的 POST Content-Length 超出了 Unknow

时间:2023-01-17
本文介绍了PHP 警告:113 字节的 POST Content-Length 超出了 Unknown 中 -1988100096 字节的限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have been having lot of problems with users uploading images on my website.

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

They can upload up to 6 images

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

Originally I had to change values in php.ini to:

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

我不得不改成这样,因为出现各种错误,例如内存不足、超过最大帖子数等.

I had to change to this as was getting all sorts of errors like out of memory, maximum post exceeded etc.

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

Everything was going ok till I checked my error log which contained :

[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,我会收到如下消息:

if I change the post max value back top 8M I get message like this:

PHP Warning:  POST Content-Length of 11933650 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

有什么想法我哪里出错了吗?

Any ideas where I am going wrong?

推荐答案

在某些 32 位系统上,PHP 将采用 2000M2G 等内存设置并将其转换为不执行边界检查的整数字节.以 2G2048M 开头的数字将是 -2147483648 个字节.

On some 32bit systems PHP will take the memory settings like 2000M or 2G and convert it to the integer number of bytes by not performing a boundary check. A number starting at 2G or 2048M will be -2147483648 bytes then.

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

Some PHP versions cap this at the top, so it won't go into negative numbers (that is the 32 bit signed integer limit).

如果您想在这样的系统上获得最大可能的字节数,请使用 2147483647.这等于 2 GB 减 1 个字节.

If you want to achieve the maximum possible number of bytes on such a system then, use 2147483647. This is equal to two gigabytes minus one byte.

或者,如果您需要处理大数据,请考虑使用 64 位系统.

Alternatively if you need to deal with large data, consider a 64bit system.

此外,您还应该考虑以下事项:

Additionally you should consider the following:

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

According to the PHP manual, the memory_limit setting is the more important one. If it does not offer enough memory, the post-data size-check then will pass, but PHP would not have enough memory to actually handle the post-data. You will get another error than, that the memory exceeded. So when you configure your PHP, take care that post_max_size is smaller than memory_limit.

在您的示例中,memory_limit128M,因此它无法处理大小大于 ~128 兆字节的后期数据.

In your example the memory_limit is 128M, so it can not process post-data of a size larger than ~128 Megabyte.

(这篇博文显示会发生什么以及 32 位和 64 位系统上的大内存设置的行为有多大)

这篇关于PHP 警告:113 字节的 POST Content-Length 超出了 Unknown 中 -1988100096 字节的限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:在 PHP 中安全地捕获“允许的内存大小已用尽&q 下一篇:如何确定变量的内存占用(大小)?

相关文章

最新文章