|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-08-22 11:37 UTC] darklord at revai dot hu
here's a part of the code I planned to use (it's a method of an object):
function host_get($file) {
$tmpname=tempnam("/tmp","IWO".uniqid(rand()));
if (!ftp_get($this->ftp_fd,$tmpname,$file,FTP_BINARY)) {
die("Can't download from server");
}
$fd=fopen($tmpname,"r");
$a=array();
while (!feof($fd)) {
$m=fgets($fd,65536);
$a[]=$m;
}
fclose($fd);
unlink($tmpname);
return $a;
}
But sometimes (when 3 times this function was called ) the PHP interpreter hanged. (I can't reproduce this problem w/o my whole src), but when I changed the line
$m=fgets($fd,65000);
to
$m=fgets($fd,3000);
The script started to work again ...
I use debian woody with the original apache and php packages, postgres and ftp modules in this script.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 22:00:01 2025 UTC |
The -d 3 doesn't solve the problem with ftp_rawlist, but the following code works for it: $i=0; while (($a=ftp_rawlist($this->ftp_fd,$dir)) === false) { $i++; if ($i > 5) { die("Error"); } }