I have written following php code which should connect to a FTP, goto a folder and download a 60MB file on regular intervals. When i try to run the code it throws a 500 error, is it a problem with server_file
<?
// define some variables
$local_file = 'abc.zip';
$server_file = '/ftproot/abc/abc.zip';
$ftp_server="ftp.abc.biz";
$ftp_user_name="abc";
$ftp_user_pass="mypasssword";
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
echo "Successfully written to $local_file
";
}
else {
echo "There was a problem
";
}
// close the connection
ftp_close($conn_id);
?>
500: Internal server error
This error is generated when a script running on the server could not be implemented or permissions are incorrectly assigned for files or directories
Troubleshooting suggestions:
Temporarily disable any rewrite rules by renaming your .htaccess file if it exists.
Ensure that any CGI or Perl scripts have at least .755. permissions.
If trying to run PHP and you get this error, you may have an invalid php.ini in your /cgi-bin, or may be missing your php.dat file in this folder.
.HTACCESS FILE
Options -Indexes
FTP View