2013-03-29 76 views
1

我有从我们的网站下载服务的问题。大文件不会全部下载。下载将停止之间的某个地方...例如this file(大小cca 172MB)将不会以全尺寸下载(还有其他文件)。PHP文件下载不下载整个文件

我从完全PHP基下载脚本切换,包括在Kohana的框架的一个:

return download::force($filePath);

到MOD-xsendfile溶液。我正在阅读有关基于PHP的下载脚本可能存在的问题以及mod-xsendfile中的大型文件和凸轮问题是正确的解决方案......好像看起来不是这样,我用两种技术都得到了相同的结果。我目前的下载实施使用像这样的mod-xsendfile头文件:

header("X-Sendfile: $filePath"); 
header("Content-type: application/octet-stream"); 
header('Content-Disposition: attachment; filename="' . basename($filePath) . '"'); 

我在做什么错?

UPDATE:

我用this HTTP sniffer检查响应头,这是结果,如果它有助于解决这一问题。

Status: HTTP/1.1 200 OK 
Server: Apache 
Set-Cookie: dewesoftsession=63ms5j67kc231pr4bpm8cmg1f7; expires=Sat, 30-Mar-2013 11:36:59 GMT; path=/ 
Expires: Thu, 19 Nov 1981 08:52:00 GMT 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache  
Set-Cookie: dewesoftsession=63ms5j67kc231pr4bpm8cmg1f7; expires=Sat, 30-Mar-2013 11:36:59 GMT; path=/ 
Content-Disposition: attachment; filename="DEWESoft_FULL_7_0_5.exe" 
Last-Modified: Mon, 24 Sep 2012 12:50:12 GMT  
ETag: "25814de-ac291e9-4ca7207c7fcd9" 
Content-Type: application/octet-stream 
Content-Length: 180523497 
Date: Sat, 30 Mar 2013 09:37:01 GMT 
X-Varnish: 294312007  
Age: 2 
Via: 1.1 varnish  
Connection: close 
X-Varnish-Cache: MISS 
+0

从服务器上得到的响应头是什么? –

+0

我该如何检查? –

+0

使用浏览器的开发工具;在网络选项卡下。 –

回答

1

几天后,我们设法找到导致问题的原因。 Varnish具有一个名为send_timeout的启动参数,默认设置为600秒。随着大文件下载,你可能会遇到这种超时,这会导致你的下载被中断。

因此增加上光油的send_timeout参数将帮助您解决这种问题。

+0

+1。很高兴你终于明白了:) –