Ask Warning: ftp_put () [function. ftp-put]: OpeningBINARYmodedataconnection

Source: Internet
Author: User
Could you tell me the error message "Warning: ftp_put () [function. ftp-put]: OpeningBINARYmodedataconnection"? why ?, This is an example in the PHP manual and also your answer Here 'saquickfunctionthatfiguresoutth could you tell me Warning: ftp_put () [function. ftp-put]: Opening BINARY mode data connection
Please refer to the error message for the question purpose. why?

------ Solution --------------------
This is an example in the PHP manual and your answer.

Here's a quick function that figures out the correct mode to use based on a file's extension.

Function get_ftp_mode ($ file)
{
$ Path_parts = pathinfo ($ file );

If (! Isset ($ path_parts ['extension']) return FTP_BINARY;
Switch (strtolower ($ path_parts ['extension']) {
Case 'am': case 'asp ': case 'bat': case 'C': case 'cfm': case 'CGI ': case 'conf ':
Case 'cpp ': case 'css': case 'dhtml ': case 'diz': case 'H': case 'hpp': case 'htm ':
Case 'html': case 'in': case 'INC': case 'js': case 'M4 ': case 'mak': case 'nfs ':
Case 'nsi': case 'Pa': case 'Patch ': case 'php': case 'php3': case 'php4 ': case 'php5 ':
Case 'phpml': case 'pl': case 'Po': case 'py': case 'qmail': case 'sh': case 'shtml ':
Case 'SQL': case 'tcl ': case 'tpl': case 'txt ': case 'vbs': case 'xml': case 'xrc ':
Return FTP_ASCII;
}
Return FTP_BINARY;
}

// Sample usage
Ftp_get ($ conn_id, $ local_file, $ server_file, get_ftp_mode ($ server_file ));
?>
------ Solution --------------------
Are you using the binary mode?
------ Solution --------------------
The server is usually placed behind the firewall. Therefore, if the FTP client program needs to traverse the firewall, the passive mode must be enabled. otherwise, no ftp command is returned when it is executed, until a fatal error of "maximum execution time timeout" occurs, causing the program to stop running...

Solution, can refer to: http://www.bacysoft.cn/thread-10-1-1.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.