On 'localhost' I tried to get a file from FTP server and the local file is successfully created. But when I'm trying in Ubuntu server it's displaying there was a problem and file is not downloading into server. Here is the code. And code file created in this location /var/www/html/
<?php
$local_file = 'whdfcleads.csv';
$server_file = 'hdfc/hdfc_leads.csv';
$ftp_server="*********";
$conn_id = ftp_connect($ftp_server)or die("Couldn't connect to $ftp_server");
$ftp_user_name="*****";
$ftp_user_pass="******";
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
echo "Successfully written to $local_file\n";
}
else{
echo "There was a problem\n";
}
ftp_close($conn_id);
?>
Please help me to solve this issue, in local host it's working fine but in Ubuntu server local file not creating/downloading.
The error is
Array (
[type] => 2
[message] => ftp_get(): Illegal PORT command
[file] => /var/www/html/wftp.php
[line] => 15
)