使用PHP上传大于2GB的文件 [英] Uploading a file larger than 2GB using PHP

查看:765
本文介绍了使用PHP上传大于2GB的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将大于2GB的文件上传到本地的PHP 5.3.4服务器。我设置了以下服务器变量:
$ b

  memory_limit = -1 
post_max_size = 9G
upload_max_filesize = 5G

然而,在我发现的error_log中:


PHP警告:POST内容长度为2120909412个字节超过1073741824个字节的限制,在第0行的Unknown中


有人可以告诉我为什么这样会一直不合格吗?

解决方案

从apache对POST大小的限制:

http://httpd.apache.org/docs/current/mod/core.html#limitrequestbody



看来这个限制或许,2Gb在64位安装上可能更大。我不确定在这个直接设置0没有达到编译的限制。看看这个线程的例子:

http://ubuntuforums.org/archive/index.php/t-1385890.html



然后不要忘记改变max_input_time在PHP中。



但是你已经达到了极限:-)也许你可以在浏览器端尝试一个富客户端(flash?js?),以大块或某种FTP的东西,与用户的进度指示器。


I'm trying to upload a file larger than 2GB to a local PHP 5.3.4 server. I've set the following server variables:

memory_limit = -1
post_max_size = 9G
upload_max_filesize = 5G

However, in the error_log I found:

PHP Warning: POST Content-Length of 2120909412 bytes exceeds the limit of 1073741824 bytes in Unknown on line 0

Can anyone tell me why this keeps failing please?

解决方案

Maybe this can come from apache limitations on POST size:

http://httpd.apache.org/docs/current/mod/core.html#limitrequestbody

It seems this limitation on 2Gb can be greater on 64bits installations, maybe. And i'm not sure setting 0 in this directove does not reach the compilation limit. see for examples that thread:

http://ubuntuforums.org/archive/index.php/t-1385890.html

Then do not forget to alter as well the max_input_time in PHP.

But you are reaching high limits :-) maybe you could try a rich client (flash? js?) on the browser side, doing the transfer in chunks or some sort of FTP things, with progress indicators for the user.

这篇关于使用PHP上传大于2GB的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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