PHP:上传大文件失败 [英] PHP: Uploading large files fail
问题描述
Im confused ...我似乎无法上传2gb范围内的文件。当我尝试使用curl发送一个1.92gb文件到我的网站(通过一个API),它不报告任何东西,它只是空白。当我发送一个1kb的文件,它报告回应该应该的。
Im confused... I can't seem to upload files in the 2gb range. When i try using curl to send a 1.92gb file to my site (through an API), it doesn't report anything at all, its just blank. When i send a 1kb file, it reports back like it should.
当我尝试通过上传表单上传,它结束了中途冻结,约33%。虽然不知道如果只有进度条冻结或如果实际文件上传它自己已被暂停。我怀疑只有进度条冻结,因为它仍然表示数据被发送,即使进度条冻结。
When i try uploading via the upload form, it ends up freezing mid way, around 33%. Although im not sure if only the progress bar has froze or if the actual file upload it self has been suspended. I suspect that only the progress bar has froze because it still says data is being sent even though the progress bar freezes.
我的php.ini(是的,它反映的phpinfo以及):
My php.ini (yes, its reflected by phpinfo as well):
register_globals = Off
magic_quotes_gpc = Off
post_max_size = 2047M
upload_max_filesize = 2047M
max_execution_time = 25200 ; Maximum execution time of each script, in seconds
max_input_time = 25200 ; Maximum amount of time each script may spend parsing request data
memory_limit = 2048M ; Maximum amount of memory a script may consume (16MB)
short_open_tag = On
实际上有2gb的RAM,但memory_limit真的需要设置这个高吗?
My vps doesnt actually have 2gb of ram at its disposal, but does memory_limit really need to be set this high?
我应该如何测试这个?我知道400mb文件工作,我没有测试任何在400mb和1.92gb之间
How should i go about testing this? I know 400mb files work, i haven't tested anything in between 400mb and 1.92gb
您需要一个高级帐户测试高达2gb,所以这里是一个可以使用:
You will need a premium account to test up to 2gb, so here is one you can play with:
用户:testreferral
User: testreferral
通行证:1234
我不明白此问题出现的原因。
I dont understand where this problem is arising.
推荐答案
http://stackoverflow.com/questions/4083398/php-mysql-query-skipped-ignored-after-large-file-uploads
Mysql在文件上传过程中超时。因此文件未显示在DB
Mysql was timing out during the file upload. So the file wasn't showing up in the DB
这篇关于PHP:上传大文件失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!