PHP Upload Issues

3 posts / 0 new
Last post
#1 Mon, 09/20/2010 - 11:18
AlReece45

PHP Upload Issues

I'm trying to find the problem here. The issue only occurs when upload files larger than 2.6MiB (perhaps a little less, 2.6MiB was small enough to reproduce quickly) When running PHP as an Apache Module, or a CGI module, the files upload correctly (as confirmed by a sha1sum and a md5sum).

However, when configured to run as FCGId, the upload succeeds, but is always corrupt (the corruption is usually consistent). The filesize remains the same. I have repeated this with binary and text files.

Has anyone else had upload issues like this when PHP is configured with FCGId. Is anyone else running PHP/FCGId with no upload problems with files larger than 2.6MiB?

Mon, 09/20/2010 - 12:19
AlReece45

As usual, I solved my own problem. For others who may run into this issue. It applies to a specific version of mod_fcgid. You need to update it (one of the sources say downgrade, but an update is available that fixes it).

If you're running Ubuntu 10.04, ensure that lucid-updates repository is enabled for universe as that's where the corrected version exists.

Sources: https://bugs.launchpad.net/ubuntu/+source/libapache2-mod-fcgid/+bug/573591 http://www.socinfo.com/ubuntu/php/fcgid/bug-fix-corrupt-files-upload

Tue, 03/29/2011 - 10:54
rodrigoderteano

I wasn't able to upload files through php either.

I solved it adding the MaxRequestLen line in /etc/apache2/mods-available/fcgid.conf

AddHandler fcgid-script .fcgi
FcgidConnectTimeout 20
MaxRequestLen 33554432

The 33554432 number is equivalent to 32MB in bytes. Set it bigger or equal to your post_max_size and upload_max_filesize, and that should solve the problem on debian squeeze.

This should be taken care by virtualmin, though I don't know if it's a mod_fcgid bug or the expected behavior

Topic locked