Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running apache2.2.12 along with PHP 5.2.10. PHP is configured to run as a separate process through fcgid. The problem is that when users upload a file, size of the apache process swells by almost the same amount. So if somebody tries to upload a 200 MB file, one of the child process swells to current size+200 MB. If 2 users simultaneously start uploading, my server crashes.

Now it is the virtual memory size which is increasing but since I am on a OpenVZ based VPS, that is what counts.

My questions are:

  • Is it the normal Apache behavior or can I do something to fix this?
  • If not, is there a more memory efficient way of handling big file uploads. Going by the current behavior, I will need 1 GB of free RAM for every apache child accepting a upload.




share|improve this question
What is the php setting of memory_limit ? – radius Jun 2 '10 at 10:04

Interesting issue, and it seems to be a limitation of php. See the following:

They both in the end seem to say "Use java or Perl" or something else. Perhaps someone on stackoverflow has the answer. For uploads this large, sftp might be the better solution depending on how user friendly this needs to be.

If you are willing to use non-php, JUpload looks like a good option since it can break the file into chunks and flush out each chunk to disk. If it has to be php, it looks like you might be able to roll out something custom with some socket programing according to this stackoverflow post.

At this size, you probably want something with resume and progress capability anyways.

share|improve this answer

Your Answer


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.