This is the line in question, just for testing:
var_dump(ftp_connect("ftp.something.com"));
The script above works fine if i call it from the browser, the response is the following:
resource(1) of type (FTP Buffer)
If i try to call it using cron or from the shell, the response is:
bool(false)
So looks like the ftp_connect function is working fine using cron, but somehow it can't connect to an external location. If i change the ftp address to "localhost", its working fine again:
resource(4) of type (FTP Buffer)
Any idea what might cause this issue? Maybe a firewall on the server?
Connection to a ftp server across proxy
$ftp_server = "proxy"; f.e. 123.456.789.10
$ftp_user_name = "username@ftpserver"; f.e. exampleuk@www.example.uk
$ftp_user_pass = "password";
$conn_id = ftp_connect($ftp_server, 2121);
$login_result = ftp_login( $conn_id, $ftp_user_name, $ftp_user_pass );
The other useful function is set_time_limit(0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.