From:             coen at rtvnh dot nl
Operating system: Windows XP
PHP version:      5CVS-2007-02-12 (CVS)
PHP Bug Type:     FTP related
Bug description:  bug in ftp_get?

Description:
------------
I've made a script to download multiple big video files (+/- 1 GB each).
When I run the script it will download the first file, but when I see the
file is completely transfered (same number of bytes) the function will not

set the file complete. It somehow waits for more data. But after 60
seconds the timeout will come in and the function gives back a false.

I've tried the same script on files of about 35 MB and there isn't any
problem. All the files will be downloaded and the function will return a
true.

I've made some changes in de php.ini file to be sure that wasn't the
problem:
max_execution_time = 28800
max_input_time = 28800
memory_limit = 8000M
post_max_size = 8000M
upload_max_filesize = 2000M

Reproduce code:
---------------
 <?php
  ini_set('error_reporting', E_ALL);
  ini_set('display_errors', TRUE);
     $HOST="***";
     $UN="***";
     $PW="***";
     $DIR="***";

     $conn = ftp_connect($HOST);
     if(!$conn) {
        exit("Could not connect to server: $HOST\n");
    }

    if(!ftp_login($conn,$UN,$PW)) {
        ftp_quit($conn);
        exit("Could not log in\n");
    }

    ftp_chdir($conn,$DIR);
    $files = ftp_nlist($conn,".");

 $i=0;
 while($files[$i]){
     if(substr($files[$i],-4)==".mpg"){
          if(ftp_pasv( $conn, true )){echo "Pasive Mode\n";}
          $downloadpath="d:/www/phpscripts/download/".$files[$i];
          if(ftp_get($conn, $downloadpath, $files[$i],FTP_BINARY)){
          echo "Received file ".$files[$i]." ok\n";
          }
          else
          {
          echo "Did not received file ".$files[$i]." ok!\n";
          echo "Result: ".$result."\n";
          }
  }
 $i++;
 }
    ftp_quit($conn);
?>

Expected result:
----------------
I expect all files to be downloaded 1 by one. Like it does on the littler
files.

Actual result:
--------------
First file will be downloaded, but doesn't see the whole file is in. And
the script will delete the file that was downloaded.

This are is what the script returns:
        Pasive Mode

Warning: ftp_get(): Opening BINARY data connection for HAA - AGO REGIO 
ZONDER VO
.mpg (640526340 bytes) in D:\www\phpscripts\ftp.php on line 35
Did not received file HAA - AGO REGIO ZONDER VO.mpg ok!

Notice: Undefined variable: result in D:\www\phpscripts\ftp.php on line
47
Result:

Notice: Undefined variable: fail in D:\www\phpscripts\ftp.php on line 48

Warning: ftp_get(): Opening BINARY data connection for HAA - AGO REGIO 
ZONDER VO
.mpg (640526340 bytes) in D:\www\phpscripts\ftp.php on line 35
Did not received file HEL - VOL SAMENVATTING REGIO zonder VO.mpg ok!

Notice: Undefined variable: result in D:\www\phpscripts\ftp.php on line
47
Result:

Warning: ftp_get(): Opening BINARY data connection for HAA - AGO REGIO 
ZONDER VO
.mpg (640526340 bytes) in D:\www\phpscripts\ftp.php on line 35
Did not received file MVV - STO ZONDER VO.mpg ok!

Notice: Undefined variable: result in D:\www\phpscripts\ftp.php on line
47
Result:

Warning: ftp_get(): Opening BINARY data connection for HAA - AGO REGIO 
ZONDER VO
.mpg (640526340 bytes) in D:\www\phpscripts\ftp.php on line 35
Did not received file STO - GRA SAMENVATTING TBV REGIO ZONDER VO.mpg ok!

Notice: Undefined variable: result in D:\www\phpscripts\ftp.php on line
47
Result:

Warning: ftp_get(): Opening BINARY data connection for HAA - AGO REGIO 
ZONDER VO
.mpg (640526340 bytes) in D:\www\phpscripts\ftp.php on line 35
Did not received file VOL - FOR REGIO ZONDER VO.mpg ok!

Notice: Undefined variable: result in D:\www\phpscripts\ftp.php on line
47
Result:

Notice: Undefined offset:  5 in D:\www\phpscripts\ftp.php on line 24

-- 
Edit bug report at http://bugs.php.net/?id=40445&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40445&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40445&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40445&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40445&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40445&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40445&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40445&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40445&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40445&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40445&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40445&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40445&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40445&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40445&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40445&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40445&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40445&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40445&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40445&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40445&r=mysqlcfg

Reply via email to