나는 중대한 초보자이지만 게시하기 전에 많은 연구를 했으므로 도움을받을 수 있기를 바랍니다.대용량 .zip 파일 다운로드 완료 불완전
약 6.4GB의 Apache 서버에서 호스팅되는 대형 .zip 파일을 제공하려고합니다. 이 파일은 브라우저에서 전체 다운로드를 표시하지만 실제로는 약 500MB 만 다운로드되었습니다. 이것은 매우 일반적인 문제인 것처럼 보이고 웹에 많은 다른 게시물과 정보를 발견했지만 문제는 계속되었습니다.
IE download incomplete even though it claims success
Large zip downloads failing only in IE
내가 크롬 39.0.2171.71으로 테스트되었습니다하지만 파이어 폭스와 IE와 같은 문제를 얻을 수
Large Zip file offered for download using php
. 내 파일이 다른 사람들이 게시 한 것보다 훨씬 크기 때문에 솔루션이 상황을 도왔지만 근본 문제를 해결하지 못했을 것으로 생각됩니다. 400Mb 정도의 두 번째 .zip 파일이 있는데 성공으로 동일한 http 헤더를 사용합니다.가장 유용한 기사는 다음과 같습니다. http://perishablepress.com/http-headers-file-downloads/이 웹 사이트의 다른 포스터가 그랬던 것처럼 http://perishablepress.com/http-headers-file-downloads/과 아래 소스에 표시된 많은 PHP를 복사했습니다.
X-SendFile을 사용해 보았지만 웹 호스트에 적절한 Apache 모듈이 설치되어 있다고 생각하지 않습니다. 나는 이것에 종일 종사하고, 아이디어를 다 썼다! 나는 다운로드 관리자를 성공으로 사용했는데, 이것이 우연히 만난 것인지 아니면 모르는 것인지 모르겠다.하지만 고객이 .zip 파일을 얻기 위해 별도의 프로그램을 다운로드하여 설치해야하는 것은 원하지 않는다.
<?php
// HTTP Headers for ZIP File Downloads
// set example variables
$filename = "huge.zip";
$filepath = "****";
// http headers for zip downloads
// header("X-Sendfile: $filepath$filename");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$filename."\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filepath.$filename));
set_time_limit(0);
ob_end_flush();
@readfile($filepath.$filename);
?>
는 여기에 내가
Remote Address:76.162.142.242 Request URL:****/GetSW.php Request Method:GET Status Code:200 OK Request Headers Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding:gzip, deflate, sdch Accept-Language:en-US,en;q=0.8 Authorization:Basic ****** Connection:keep-alive Cookie:_ga=GA1.2.1176828605.1417985823 DNT:1 Host:www.teamursa.org Referer:http://www.teamursa.org/****.html User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Response Headers Cache-Control:public Connection:Keep-Alive Content-Description:File Transfer Content-Disposition:attachment; filename="huge.zip" Content-Length:6720560824 Content-Transfer-Encoding:binary Content-Type:application/octet-stream Date:Sun, 07 Dec 2014 22:16:57 GMT Expires:0 Keep-Alive:timeout=3, max=120 Pragma:public Server:Apache X-Powered-By:PHP/5.2.17
에서 계속 증가 후 아래보십시오. 'readfile() '대신 실제 전송을 Apache에 위임합니다. Apache는 실제로'mod_xsendfile'을 사용해야합니다. PHP 스크립트는 부분/바이트 범위 전송을 구현하지 않으므로 HTTP 다운로드가 다시 시작됩니다. PHP에서 그 중 하나를 다시 구현하려는 노력은 가치가 없습니다. - PHP 스크립트 래퍼의 원래 이유는 무엇입니까? – mario
ftp는 http보다 더 큰 파일 전송 * 친숙 *입니다. 그 옵션이 –
이라면 가장 좋은 추측은 php 스크립트가 http://php.net/manual/en/info의 'max_execution_time'설정으로 인해 죽게된다는 것입니다. configuration.php # ini.max-execution-time. 따라서 브라우저는 해당 시간대에 readfile이 보내는 것을 관리합니다. – adrian7