Memory Limits, 500 Error, Huge Uploading Issues

喜你入骨 提交于 2019-12-24 10:55:46

问题


read around on some answers and never found something that directly related to my issue.

I have a 48Megabyte .csv file I am trying to upload and run so the clients can do a massive product update/insert. We can occasionally get the upload to work, but right now I'm getting a 500 Error returned on my Ajax request. Here are some of the details:

Our server support set the maximum upload file size to 100 Megabytes.

I am using the following ini_sets at the top of the script:

set_time_limit(0);
ini_set("memory_limit",-1);
ini_set('max_execution_time', 0);

Here's where I think the problem is. Due to the amount of testing I have to do to make this script work; I probably do about 10 uploads a day. This is really stressing the server, as well as the fact that their site is receiving about 500 visits a day at the moment as well.

Monthly Bandwidth Transfer: 12775.43 / 3000 MB

Any ideas I can return to my boss with regarding this issue? It kinda needed to be done today, and I'm still working on cleaning issues but if it's a bandwidth thing then we can't do the test again until tomorrow when the server resets it's monthly bandwidth.

Thanks for any ideas.

Notes: This has worked in the past. If I do smaller sized files, it works just as well, but the client explicitly requires us to use this 48 Megabyte .csv file.

Notes again: It seems like the upload tool is working to an extent because it posts and uploads to the folder I want it to post to. The problem I think is that after spending 10 minutes uploading and preparing the file, it doesn't have long to parse all the data and times out.

Another set of notes: Following is the 500 Internal Server issue:

The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@____.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.


回答1:


Maybe this is of any help.

https://github.com/valums/file-uploader/issues/61

I've tested uploading large files (a 20MB+ file with a 64MB php memory setting), and got consistent memory maxed out errors from PHP, because it was loading the uploaded XHR content into $HTTP_RAW_POST_DATA. Despite setting always_populate_raw_post_data to false it kept doing this, and as the docs are a little sparse on the issue, I had trouble solving it. Turns out, if you fake the content type to "multipart/form-data", PHP does not populate $HTTP_RAW_POST_DATA (I tried other content types, this is the only one that seems to work), and you can upload large files without hitting a low memory limit. Binary integrity is mantained, at least with Chrome and Firefox, which is what I tried.*

I found it here:

Reduce memory consumption in PHP while handling uploads by php input



来源:https://stackoverflow.com/questions/11743486/memory-limits-500-error-huge-uploading-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!