damion Posted August 9, 2015 Share Posted August 9, 2015 Hope you can help explain this warning. I have an upload script that chokes intermittently during uploads, but very rare when it does. It's an annoyance more than anything else. There are no helpful errors on the form when it does fail, but I happened to look at the error log on the server and found this repeated a few dozen times (always has the same limit value): PHP Warning: Unknown: POST Content-Length of 0 bytes exceeds the limit of -1051798902 bytes in Unknown on line 0 My php.ini file bumps up the memory, post and upload size, etc, and I can upload pretty huge files successfully, the biggest was over a half gigabyte once. I know ftp is the best way to go for large files. But this is reliable enough for my use and I'm just trying to understand the warning message. I can't find any results when I do a google search that has '0' as the content length, it's always a larger number. Tnx Quote Link to comment https://forums.phpfreaks.com/topic/297700-php-warning-unknown-post-content-length-of-0-bytes-exceeds-the-limit-of-xxxxxxxxxx-bytes-in-unknown-on-line-0/ Share on other sites More sharing options...
mac_gyver Posted August 9, 2015 Share Posted August 9, 2015 normally, the Content-Length is the value that the browser sent in the request when it starts to submit the form data, even if that value is greater than the post_max_size setting. i'm guessing that you either found a bug in php or you are on a 32bit system, the post_max_size setting is greater than a 32bit signed integer (2,147,483,647), and the math that php is doing to check the Content-Length against that setting is failing and resulting the a zero being listed for the Content-Length. the fact that the limit is being reported as a negative number supports the 32bit signed integer limit possibility. also, afaik, when the Content-Length is greater then the post_max_size setting, php tries (wishful thinking) to abort the upload. it may be that the browser/client you are using respects this, and then sends another post request with a Content-Length of zero. what is your post_max_size setting (what exactly are you setting it to and what does a phpinfo() statement report it being) and are you doing this on a 32bit php installation? Quote Link to comment https://forums.phpfreaks.com/topic/297700-php-warning-unknown-post-content-length-of-0-bytes-exceeds-the-limit-of-xxxxxxxxxx-bytes-in-unknown-on-line-0/#findComment-1518359 Share on other sites More sharing options...
mac_gyver Posted August 9, 2015 Share Posted August 9, 2015 (edited) a post method form that has no name='....' attributes in the fields or has only empty name='' attributes in the fields will also send a CONTENT_LENGTH of zero. is there any chance that you are dynamically producing the form, either via php or javascript, or are using javascript to submit the form? Edited August 9, 2015 by mac_gyver Quote Link to comment https://forums.phpfreaks.com/topic/297700-php-warning-unknown-post-content-length-of-0-bytes-exceeds-the-limit-of-xxxxxxxxxx-bytes-in-unknown-on-line-0/#findComment-1518363 Share on other sites More sharing options...
damion Posted August 9, 2015 Author Share Posted August 9, 2015 mac_gyver, thanks for your help. The server is a 64bit and phpinfo() shows what I have in my php.ini file for post_max_size. It is 3072M. But...the form does not have a name="", not even a blank value for it. This is it: <form id="form1" action="upload.php" method="post" enctype="multipart/form-data"> Unfortunatley, I won't be able to help with the answer of how the form is being produced. I don't know. But I do know there is PHP, js, and ajax there. And some flash too for the uploader. So several files can be uploaded at one time, the form has multiple file fields if it helps you to know. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/297700-php-warning-unknown-post-content-length-of-0-bytes-exceeds-the-limit-of-xxxxxxxxxx-bytes-in-unknown-on-line-0/#findComment-1518375 Share on other sites More sharing options...
iarp Posted August 9, 2015 Share Posted August 9, 2015 But I do know there is PHP, js, and ajax there. And some flash too for the uploader. What is the uploading chunk size? Does it attempt to upload the entire thing at once or in chunks? Quote Link to comment https://forums.phpfreaks.com/topic/297700-php-warning-unknown-post-content-length-of-0-bytes-exceeds-the-limit-of-xxxxxxxxxx-bytes-in-unknown-on-line-0/#findComment-1518376 Share on other sites More sharing options...
mac_gyver Posted August 9, 2015 Share Posted August 9, 2015 The server is a 64bit that may be, but is the php language engine 32 or 64 bit? a post method form that has no name='....' attributes in the fields or has only empty name='' attributes in the fields will also send a CONTENT_LENGTH of zero. is there any chance that you are dynamically producing the form, either via php or javascript, or are using javascript to submit the form? that statement concerns the form fields, not the <form tag. But I do know there is PHP, js, and ajax there. And some flash too for the uploader. that sounds like it's one of the third-party flash based file unloaders. care to share which one in case someone has some specific knowledge about it and your symptom that could lead to a solution? Quote Link to comment https://forums.phpfreaks.com/topic/297700-php-warning-unknown-post-content-length-of-0-bytes-exceeds-the-limit-of-xxxxxxxxxx-bytes-in-unknown-on-line-0/#findComment-1518377 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.