Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using the following setup:

  • CentOS 5.9
  • Apache with Nginx proxy for static resources
  • PHP 5.4
  • fastcgi

When uploading smaller files, everything works fine. If however I try to upload larger files (I haven't yet determined the cut off point) I get 500 errors.

My apache logs are set to E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED

When this first occurred I checked the logs and saw that the POST was longer than the MaxRequestLen in fcgi config.

I promptly changed this in both my php.conf file and in my post_virtualHost include file from within cPanel. This prevented the error message from getting logged but i still receive the 500 errors, and confusingly, no errors relating to this are getting logged whatsoever.

From the clients point of view the file seems to upload fine and takes a long as it should (with html5 file api reporting the progress correctly throughout) and the 500 error is generated after the server has received the full file during a lengthy script execution afterwards.

The file itself is a large text file containing several base64 images which are then pulled apart server side, converted into actual image files using ImageMajick (via the IMajik php extension) and are then duplicated into several different size versions with varying levels of filtering/compression applied to them. This whole process can take quite some time. Could this be part of the problem? If so how would I fix it?

My fcgi configuration is current as follows:

MaxRequestsPerProcess 1000
FcgidMaxProcesses 200
FcgidProcessLifeTime 7200
MaxProcessCount 500
FcgidIOTimeout 400
FcgidIdleTimeout 600
FcgidIdleScanInterval 90
FcgidBusyTimeout 300
FcgidBusyScanInterval 80
ErrorScanInterval 3
ZombieScanInterval 3
DefaultMinClassProcessCount 0
DefaultMaxClassProcessCount 3
FcgidMaxRequestLen  1073741824

I have tried replacing FcgidMaxRequestLen with the older MaxRequestLen but still no luck.

Any help would be greatly appreciated.

share|improve this question

1 Answer 1

Any chance that your script simply times out? FcgidBusyTimeout is 5 minutes — maybe it isn't enough when several scripts are running concurrently.

Why do you use fcgi instead of mod_php? If you use ngix as a reverse proxy and for serving static content then fcgi is just another layer of complexity: ngix+apache is good, apache+fcgi is good, ngix+fcgi is good, ngix+apache+fcgi does not make sense.

share|improve this answer
    
Sadly I've already tried increasing the timeouts but to no avail. Thanks for the suggestion though. With regards to the stack, although it adds complexity there are certain features of fcgi that we need. nginx is going to be pulled in favour of a permanent CDN for static resources when the app goes live anyway. –  user6595 Feb 19 '13 at 0:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.