ftp_put工作了一个月,现在已经停止了?

Hi have the below syntax:

$source = $csv_filename;  
$target = '/locexport/'.$csv_filename;
$conn = ftp_connect("ftp.server.com") or die("Could not connect");
ftp_login($conn, "ftpusername", "ftppassword");

ftp_pasv($conn, false); 

$upload = ftp_put($conn, $target, $source, FTP_ASCII);
if (!$upload) { echo 'FTP upload failed!'; }

This script runs with cron jobs every few hours and has worked for months.

it has suddenly stopped working.

echoing $source and $destination shows the correct paths.

error message is:

Warning: ftp_put() [function.ftp-put]: Opening ASCII mode data connection. in /home/shareduser/public_html/export/export.php on line 55
FTP upload failed!

line 55 is:

 $upload = ftp_put($conn, $target, $source, FTP_ASCII);

I have tried changing FTP_ASCII to FTP_BINARY but with the same result.

any ides how to troubleshoot this? it is not a permission issue as a manual transfer in Filezilla with the same credentials succeeds.

Thanks and Regards.

You could try to switch to passive mode (set it to true):

ftp_pasv($conn, true);

Maybe something has changed in destination's firewall.

Similar problem here, but the Warning I get is: ftp_fput(): Accepted data connection

Used FTP_BINARY, FTP_ASCII used passive/active modes, no luck. Could be a bug? see Bug #46531 ftp_put returns error on Accepted data connection

EDIT: Found a workaround, not sure it will work for anyone as it involves SSL connection, the bad thing is it was working fine until last PHP update (updated to 5.6.14)

Solution: don't use ftp_ssl_connect use ftp_connect instead