我有一點,從我們的開發服務器傳輸備份代碼,並隨機似乎表現得非常奇怪,並給予下列錯誤/輸出:警告:ftp_get():刪除操作成功
Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
ERR blahjob: Failed to get file: 2013-09-25_18-22-04-blahjob_dev18.tgz
PHP Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
ERR blahjob: Failed to get file: 2013-09-25_18-22-37-blahjob_dev19.tgz
PHP Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
ERR blahjob: Failed to get file: 2013-09-25_18-23-05-blahjob_dev5.tgz
PHP Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
ERR blahjob: Failed to get file: 2013-09-25_18-23-37-blahjob_dev33.tgz
我並沒有絲毫的想法,刪除與ftp_get()
有什麼關係,或者爲什麼它返回false
並且對另一個操作的成功提出警告。谷歌也找不到任何類似的問題。
代碼中的問題:
// ftp connection established, file list acquired, yadda yadda
foreach($targets as $target) {
$localfile = $backup_dir . $target;
if(file_exists($localfile)) {
do_log($task['name'], "Local file ".$target." already exists, skipping.", 1);
continue;
}
if(! ftp_get($conn, $localfile, $target, FTP_BINARY)) { // line 106
do_log($task['name'], "Failed to get file: ".$target, 2);
} else {
do_log($task['name'], "Got file: ".$target);
ftp_delete($conn, $target);
}
}
您使用的是什麼服務器設置?本地,這個PHP腳本運行的地方。 – idmean
@wumm運行PHP 5.2.10的CentOS 5.7服務器,該腳本通過CLI/cron運行。 – Sammitch
你能展示他們與你的目標陣列嗎?你是不是定義了'$ task ['name']'> – Perry