I have Apache 2.x, PHP 5.x installed in Linux server. The application has PHP files in the document root and 2 .cgi files (upload.cgi and progress.cgi) in the apache's cgi-bin directory. The upload.cgi takes care of uploading the file from the client to the server and the progress.cgi displays the progress bar of how much % of data is being transferred. So, basically the application is a mixture of PHP and Perl (since PHP doesn't handle the raw POST data)! Now, everything works fine and great!!
Problem is in the production environment. They have Apache 1.3 and PHP 5.x installed in Linux server. Small images less than say 500 KBytes works just fine. If the image is > 500 KByte, the progress bar works till 99% and upload.cgi reports "An internal server occurred". The apache error log says: "Premature end of scripts at header.cgi". This happens for 1MB image as well as 4.5MB image file but not for the < 500 KB image files!
I checked the max_upload_time, upload limit, etc., everything is okay. I wonder why this problem occurs only if the file size is bigger!