Reputation: 1785
I don't have any problem to download files throught ftp with ftp_get
except when I have a 4GB file.
It takes some times to get the file and I get this error :
ErrorException: ftp_get(): Timeout
I'm using this simple example here : https://php.net/ftp_get
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
echo "Le fichier $local_file a été écrit avec succès\n";
} else {
echo "Il y a un problème\n";
}
Is there any way to increase the timeout ? Or maybe another solution ?
Thanks !
Upvotes: 0
Views: 1155
Reputation: 51
Had the same problem before. I was trying to get too many files at one time.
The solution was to limit the amount of files to download and then if you have access to the FTP, try to improve the timeout or check the log to get more details. Check also if you can split this file in smaller ones.
Upvotes: 1