大文件的上传与PHP错误 [英] Large File Upload Errors with PHP

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

问题描述

我有一个幻灯片的图片上传,以及用户不断上传是2MB加文件。根据本大小做工精细的文件,但文件在大小造成什么看起来像一个浏览器超时。

I have an image upload for a slideshow, and the users are continuously uploading files that are 2MB plus. Files under this size work fine, but files over the size cause what looks like a browser timeout.

下面是我的PHP INI设置:

Here are my php ini settings:


  • 最大内存分配:12M

  • 最大上传文件大小:10M

  • 最大HTTP POST大小:10M

  • 执行最大时间:60

  • 最大输入解析时间:120

这些设置是配置文件本身,我可以直接改变它们。变化显示使用phpinfo()函数时。

These settings are in the configuration file itself, and I can change them directly. Changes show up when using phpinfo().

我是一个Apache服务器和PHP 4.3.9(客户的选择,不是我的)上运行。 Apache服务器的请求限制设置为默认情况下,我相信这是2GB左右的地方?

I am running on an apache server and php 4.3.9(client's choice, not mine). The apache server's request limit is set to default, which I believe is somewhere around 2GB?

当我用萤火虫网络监控,它看起来像我无法接收来自服务器的完整的响应,虽然我不是太在使用这个工具的经验。事情似乎在约43秒内超时。

When I use the firebug network monitor, it does look like I am not receiving a full response from the server, though I am not too experienced at using this tool. Things seem to be timing out at around 43 seconds.

所有的帮助,我可以在网络上找到指向上方设置的元凶,但所有的这些设置比这2MB的文件和43个第二次了。高得多

All the help I can find on the net points to the above settings as the culprits, but all of those settings are much higher than this 2MB file and the 43 second time out.

在那里我可以从这里去解决这个问题有什么建议?

Any suggestions at where I can go from here to solve this issue?

下面是相关的phpinfo PHP INI设置()。让我知道如果我需要张贴了。

Here are relevant php ini settings from phpinfo(). Let me know if I need to post any more.


  • file_uploads开开

  • 的max_execution_time 60 60

  • max_input_nesting_level 64 64

  • max_input_time设置120 120

  • memory_limit的12M 12M

  • 的post_max_size 10M 10M

  • safe_mode设置关闭关闭

  • 的upload_max_filesize 10M 10M

  • upload_tmp_dir没有价值没有价值

推荐答案

请确保您已在php.ini启动错误报告:的display_errors =打开;这可能给你一个什么回事线索。生产服务器通常(应该)有错误报告禁用。

Make sure you have error reporting activated in php.ini: display_errors = On; this might give you a clue about what's going on. Production servers usually (should) have error reporting disabled.

我最近有一个类似的问题,并增加memory_limit的设置为我工作。如果你读文件的内容成变量,每个变量约需尽可能多的内存文件的大小,增加了脚本的内存需求。

I recently had a similar problem, and increasing the memory_limit setting worked for me. If you read files content into variables, each variable will take about as much memory as the file size, increasing the scripts memory requirements.

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

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