I have a script that has been running for several months without a problem, that suddenly started to have problems without any changes to the code, or known changes to the environment.
The script is running as a CLI module under 5.2 on a Windows machine. The script connects to a Unix host via ftp, reads the contents of a specified directory, then downloads files to the Windows machine.
The code goes like this:
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (!($type = ftp_systype($conn_id)))
{
logaction("Couldn't connect to server.");
} else
{
ftp_pasv($conn_id, true);
ftp_chdir($conn_id, "mydirectory");
$rawlist = ftp_rawlist($conn_id, ".");
foreach ($rawlist as $file)
{
do stuff..
}
}
When we hit the ftp_rawlist statement, we get the following error:
Warning: ftp_rawlist(): php_connect_nonb() failed: No error (0) in X:\shell\ftpfiles.inc on line 24
Note that this does not happen all the time; when the script first starts running for the day things are ok, then at some point after a while the error starts occurring. If the script is stopped for about half an hour, and then restarted, things run fine.
I have googled the error, but can't find anything relevant. Any suggestion on what might be going on?
Thanks much,
Barry