内存限制,500错误,巨大的上传问题 [英] Memory Limits, 500 Error, Huge Uploading Issues

查看:196
本文介绍了内存限制,500错误,巨大的上传问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个48兆字节的.csv文件我试图上传并运行,所以客户可以做大量的产品更新/插入。我们偶尔可以让上传工作,但现在我得到了我的Ajax请求上返回的500错误。以下是一些细节:

我们的服务器支持将最大上传文件大小设置为100兆字节。



我在脚本的顶部使用了以下ini_sets:

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

这是我认为问题所在的地方。由于测试的数量,我必须做这个脚本的工作;我大概每天做10次上传。这真的是强调服务器,以及他们的网站每天接受约500次访问的事实。

每月带宽转移:12775.43 / 3000 MB



有什么想法可以返回给我的老板关于这个问题?今天需要做的事情,我仍然在清理问题,但如果是带宽的事情,我们不能再做测试,直到明天当服务器重置它的每月带宽。

感谢您的任何建议。



注意:这一点在过去已经奏效。如果我的文件尺寸较小,它也可以正常工作,但客户端明确要求我们使用这个48兆字节的.csv文件。

再次提示:看起来上传工具在某种程度上工作,因为它发布并上传到我要发布的文件夹。我想这个问题是,花了10分钟上传和准备文件后,没有太多的时间来解析所有的数据和超时。

另外一组注意事项:以下是500内部服务器问题:

服务器遇到内部错误或配置错误,无法完成你的请求。
请联系服务器管理员webmaster @ _ __ _ .com,并告知他们错误发生的时间,以及您可能做过的任何事情造成了错误。
有关此错误的更多信息可能在服务器错误日志中可用。
另外,在试图使用ErrorDocument来处理请求时遇到500内部服务器错误错误。

解决方案

也许这是有帮助的。



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


I已经测试了上传大文件(一个具有64MB php内存设置的20MB +文件),并且从PHP获得了一致的内存最大错误,因为它将上载的XHR内容加载到$ HTTP_RAW_POST_DATA中。
尽管将always_populate_raw_post_data设置为false,但它一直这样做,而且由于文档在这个问题上有点稀疏,所以我很难解决这个问题。事实证明,如果你假的内容类型为multipart / form-data的,PHP不填充$ HTTP_RAW_POST_DATA(我试过其他内容类型,这是一个似乎工作的唯一的一个),你可以上传大文件没有击中低内存限制。二元完整性是至少在Chrome和Firefox,这是我试过。*

我发现它在这里:



减少PHP的内存消耗,同时通过php输入处理上传


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.

解决方案

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

这篇关于内存限制,500错误,巨大的上传问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆