I realize that there are other more straightforward ways to conduct FTP. However, I have a specific need to be able to use fopen on a file via FTP. The following code works just great:
$FTP="ftp://$FTPUser:$FTPPass@$FTPHost/$file_dest";
$fp=fopen($FTP, 'w');
The problem is when the path of the $file_dest is invalid. For example if $file_dest="1/2/3/test.txt".
If the 1, 2, or 3 folders do not exist, then it takes 90 seconds for the fopen to fail.
How can I reduce this timeout?