PHP:上传大文件失败

发布于 2024-09-30 12:35:43 字数 962 浏览 11 评论 0原文

我很困惑...我似乎无法上传 2GB 范围内的文件。当我尝试使用curl 将 1.92gb 文件发送到我的网站(通过 API)时,它根本不报告任何内容,只是空白。当我发送 1kb 文件时,它会像应有的那样报告。

当我尝试通过上传表单上传时,它最终在中途冻结,大约为 33%。虽然我不确定是否只有进度条冻结了,或者实际文件上传是否已暂停。我怀疑只有进度条冻结了,因为即使进度条冻结,它仍然表示正在发送数据。

我的 php.ini(是的,它也由 phpinfo 反映):

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 

我的 vps 实际上没有 2GB 的内存可供使用,但是内存限制真的需要设置这么高吗?

我应该如何测试这个?我知道 400mb 文件可以工作,我还没有测试过 400mb 到 1.92gb 之间的任何内容

您需要一个高级帐户来测试高达 2gb 的文件,因此您可以使用以下帐户:

User: testreferral

Pass: 1234

http://filefx.com

我不明白这个问题出现在哪里。

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.

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.

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 

My vps doesnt actually have 2gb of ram at its disposal, but does memory_limit really need to be set this high?

How should i go about testing this? I know 400mb files work, i haven't tested anything in between 400mb and 1.92gb

You will need a premium account to test up to 2gb, so here is one you can play with:

User: testreferral

Pass: 1234

http://filefx.com

I dont understand where this problem is arising.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

×纯※雪 2024-10-07 12:35:44

PHP:大文件上传后跳过/忽略 mysql 查询?

Mysql 在文件上传过程中超时。所以该文件没有出现在数据库中

PHP: mysql query skipped/ignored after large file uploads?

Mysql was timing out during the file upload. So the file wasn't showing up in the DB

鹿港小镇 2024-10-07 12:35:43

检查:

  1. 内存限制。尝试上传高于和低于实际内存限制的文件。
  2. 时限。你的上传不是需要7个多小时吗?
  3. 有效的设置。某些设置可能会被服务器/等设置覆盖。

Check for:

  1. Memory limit. Try uploading files above and below the actual memory limit.
  2. Time limit. Aren't your uploads take 7+ hours, are they?
  3. The effective settings. Some setting might be overridden by server/etc settings.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文