Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
709 views
in Technique[技术] by (71.8m points)

apache - Large File Upload Errors with PHP

I have an image upload for a slideshow, and the users are continuously uploading files that are 2MB plus. Files under this size work fine, but files over the size cause what looks like a browser timeout.

Here are my php ini settings:

  • Max memory allocation: 12M
  • Max file upload size: 10M
  • Max HTTP Post size: 10M
  • Max execution time: 60
  • Max input parsing time: 120

These settings are in the configuration file itself, and I can change them directly. Changes show up when using phpinfo().

I am running on an apache server and php 4.3.9(client's choice, not mine). The apache server's request limit is set to default, which I believe is somewhere around 2GB?

When I use the firebug network monitor, it does look like I am not receiving a full response from the server, though I am not too experienced at using this tool. Things seem to be timing out at around 43 seconds.

All the help I can find on the net points to the above settings as the culprits, but all of those settings are much higher than this 2MB file and the 43 second time out.

Any suggestions at where I can go from here to solve this issue?

Here are relevant php ini settings from phpinfo(). Let me know if I need to post any more.

  • file_uploads On On
  • max_execution_time 60 60
  • max_input_nesting_level 64 64
  • max_input_time 120 120
  • memory_limit 12M 12M
  • post_max_size 10M 10M
  • safe_mode Off Off
  • upload_max_filesize 10M 10M
  • upload_tmp_dir no value no value
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Make sure you have error reporting activated in php.ini: display_errors = On; this might give you a clue about what's going on. Production servers usually (should) have error reporting disabled.

I recently had a similar problem, and increasing the memory_limit setting worked for me. If you read files content into variables, each variable will take about as much memory as the file size, increasing the scripts memory requirements.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...