Page 1 of 1
Downloads von "großen" Dateien bricht regelmäßig a
Posted: Fri 2. Feb 2007, 23:25
by dosas
Hallo,
ich habe seit geraumer Zeit massive Probleme mit Downloads von Dateien einer Größe von 60 bis 150 MB. Download per Dateiliste.
Gerade habe ich nochmals getestet und eines feststellen können - die Downloads brechen genau nach 6 min. 45 sec. ab!!
Dies konnte ich zumindest bei mir zuhause an einer 1 Mbit DSL-Leitung feststellen.
Dies ist für unsere Interessenten und Kunden sehr ärgerlich und auf Dauer inakzeptabel. Wir haben auch schon den Provider gewechselt da wir hier schon die Probleme vermuteten (hatte auch andere Stabilitätsprobleme)
Habe momentan alles auf Links umgebaut und somit das Problem umgangen. Würde aber lieber auf die Dateiliste wieder umsteigen.
Kennt jemand dieses Phänomen?
mfg
Thomas
phpwcms-version 1.2.8
Posted: Sat 3. Feb 2007, 02:12
by Klappstuhl28
Was steht denn an dieser Stelle in der conf.inc.php ?
// content values
$phpwcms['file_maxsize']
Bei bis zu 150 MB wird´s da wohl Ärger geben.
Eine andere Idee habe ich nicht.
Lars
Posted: Sat 3. Feb 2007, 10:26
by dosas
Hallo,
da steht:
$phpwcms['file_maxsize'] = 2097152; //Bytes (50 x 1024 x 1024)
Ich dachte, dass dieser Wert aber eher für den Upload gilt. Bei 5 MB-Dateien gibt es die Problme nicht. Und auch bei einem 6 MBit-DSL-Zugang ist der Download kein Problem.
mfg
Thomas
Posted: Sat 3. Feb 2007, 10:51
by axelko
Thomas,
If you 'direct' download the big files (upload them first with ftp somewhere on your site just for testing, and then go with your browser to domain.tld/somewhere/file.zip) does this work?
If it also goes wrong the problem is not phpwcms.
If it works then just use a workaroud and put the files on the website and make links to the files in phpwcms.
But for these kind of filesizes I would recommend to use anomynous ftp.
Greetz,
Axel
Posted: Sat 3. Feb 2007, 12:08
by dosas
Hallo,
der direkte Download funktioniert ohne Probleme. Ich habe nun einen eigenen Ordner erstellt in dem die größeren Dateien liegen. Diese wurden mit der Linkliste verlinkt und funktionieren auch soweit.
Es muss irgend ein Timerproblem mit PHP oder der download.php sein.
Nützt es was, wenn ich die phpinfo's bereitstelle?
mfg
Thomas
Posted: Sat 3. Feb 2007, 15:55
by erich_k4
This seems to be fixed in the 1.2.9 nightly build. (header - Content-Range)
its the file "functions.file.inc.php"
other info
http://www.phpwcms.de/forum/viewtopic.php?p=78436#78436
but there is still a timing problem for big files: the set_time_limit(0) will not work when safe_mode=on, if the download takes longer than max_execution_time the download will be terminated.
for 1.2.8 you can use a slightly modified version of this file:
Code: Select all
<?php
/*************************************************************************************
Copyright notice
(c) 2002-2006 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.
This script is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
function _getFileInfo($value, $limit='1', $mode='hash') {
$sql = '';
switch($mode) {
case 'hash': $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_aktiv=1 AND ";
$sql .= "f_trash=0 AND f_public=1 AND ";
$sql .= "f_hash='".aporeplace($value)."'";
if($limit) {
$sql .= " LIMIT ".$limit;
}
break;
}
return _getDatabaseQueryResult($sql);
}
function dl_file_resume($file='', $fileinfo=array(), $onsuccess = false) {
// function based on this one here:
// http://www.php.net/manual/de/function.fread.php#63893
//First, see if the file exists
if (!is_file($file) && connection_status()) return false;
//Gather relevent info about file
$filename = empty($fileinfo['realfname']) ? basename($file) : $fileinfo['realfname'];
$disposition = empty($fileinfo['method']) ? 'attachment' : $fileinfo['method'];
if(empty($fileinfo['mimetype']) && empty($fileinfo['extension'])) {
$file_extension = strtolower(substr(strrchr($filename,"."),1));
//This will set the Content-Type to the appropriate setting for the file
switch( $file_extension ) {
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "mp3": $ctype="audio/mpeg"; break;
case "mpg": $ctype="video/mpeg"; break;
case "avi": $ctype="video/x-msvideo"; break;
default: $ctype="application/force-download";
}
} else {
$ctype = $fileinfo['mimetype'];
$file_extension = $fileinfo['extension'];
}
//Begin writing headers
header('Cache-Control: ');
header('Cache-Control: public');
header('Pragma: ');
//Use the switch-generated Content-Type
header('Content-Type: '.$ctype);
if (isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
// workaround for IE filename bug with multiple periods / multiple dots in filename
// that adds square brackets to filename - eg. setup.abc.exe becomes setup[1].abc.exe
$filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1);
}
//header('Accept-Ranges: bytes');
$size = filesize($file);
header('Content-Length: '.$size);
header('Content-Transfer-Encoding: binary'.LF);
//check if http_range is sent by browser (or download manager)
/*
if(isset($_SERVER['HTTP_RANGE'])) {
//if yes, download missing part
list($a, $range) = explode('=', $_SERVER['HTTP_RANGE']);
$range = explode('-', $range);
$seek_start = empty($range[0]) ? 0 : intval($range[0]);
$seek_end = empty($range[1]) ? 0 : intval($range[1]);
header('HTTP/1.1 206 Partial Content');
header('Content-Length: '.($seek_end - $seek_start + 1));
header('Content-Range: bytes '.$seek_start.'-'.$seek_end.'/'.$size);
} else {
$rage = 0;
header('Content-Range: bytes 0-'. ($size - 1) .'/'.$size);
header('Content-Length: '.$size);
}
*/
header('Content-Disposition: '.$disposition.'; filename="'.$filename.'"');
//reset time limit for big files
@set_time_limit(0);
//open the file
$fp = fopen($file, 'rb');
//seek to start of missing part
//fseek($fp, $range);
//start buffered download
while(!feof($fp) && !connection_status()){
print(fread($fp, 1024*8));
flush();
//ob_flush();
}
fclose($fp);
return ($onsuccess && !connection_status() && !connection_aborted()) ? true : false;
}
?>
Posted: Wed 7. Feb 2007, 09:13
by dosas
Hallo,
habe diesen Inhalt in die Datei kopiert. Jedoch keine Veränderung des Verhaltens feststellen können -
mfg
Thomas