I'm trying using this script to download a zip file from an FTP source olansi (on localhost it works but not on the live server form OVH).
When running it on a live server I get instantly this:
successfully connected to the ftp server!
logged in successfully!
Error while downloading from ... .
Connection closed Successfully!
So all the connection are good but it get stuck on downloading the file.
What could be the issue, or how could I get some error reports for this?
Some thinks that I have checked:
FTP support enabled (in PHP)
permission for the folder is 777;
the port is open (21);
php max execution is long (300);
the firewall provided by the hosting is disabled (I don't have any control over if is just on/off)
What else could it be?
Thank you
// Connect to FTP server
// Use a correct ftp server
$ftp_server = "localhost";
// Use correct ftp username
$ftp_username="user";
// Use correct ftp password corresponding
// to the ftp username
$ftp_userpass="user";
// Establishing ftp connection
$ftp_connection = ftp_connect($ftp_server, 21)
or die("Could not connect to $ftp_server");
if( $ftp_connection ) {
echo "successfully connected to the ftp server!";
// Logging in to established connection
// with ftp username password
$login = ftp_login($ftp_connection,
$ftp_username, $ftp_userpass);
if($login) {
// Checking whether logged in successfully
// or not
echo "
logged in successfully!";
// Name or path of the localfile to
// where the file to be downloaded
$local_file = "file.zip";
// Name or path of the server file to
// be downoaded
$server_file = "file.zip";
// Downloading the specified server file
if (ftp_get($ftp_connection, $local_file,
$server_file, FTP_BINARY)) {
echo "
Successfully downloaded from"
. " $server_file to $local_file.";
}
else {
echo "
Error while downloading from"
. " $server_file to $local_file.";
}
}
else {
echo "
login failed!";
}
// echo ftp_get_option($ftp_connection, 1);
// Closeing connection
if(ftp_close($ftp_connection)) {
echo "
Connection closed Successfully!";
}
}
?>
Ftp_get fails (returns false) on live server but works locally
Related questions
- Compte bloqué pour Spam, impossible de le débloquer
119955
03.01.2024 08:02
- Email frauduleux au nom de OVH
117312
13.08.2017 18:14
- Changer le mot de passe email depuis roundcube
117070
24.06.2017 14:28
- Autodiscover et Microsoft Outlook 2016
93254
23.11.2016 15:15
- Question sur antispam OVH
91805
17.03.2017 16:11
- OVH sur un iPhone "Échec de l'envoi de l'e-mail : l'adresse de l’expéditeur est incorre
90134
07.08.2017 08:45
- Arrêt de la commercialisation du MX plan
85388
30.11.2017 11:26
- Mail non délivrés ou en spam chez nos clients
81574
15.11.2017 10:30
- Envois de mails / erreur 521
79091
05.04.2017 11:42
- Comment configurer une entrée DNS de type DKIM chez OVH ?
78239
12.03.2019 17:41
The web servers on OVH are firewalled in order to avoid that their hosting is (mis)used as a relay for unwelcome activities.