我現在有一個PHP ChronJob,使我的數據庫的日常備份,並且腳本如下:獲取mysqldump的調試信息
<?php
set_time_limit(86000);
include($_SERVER['DOCUMENT_ROOT']."/pagetop.php");
$db = new dbsettings;
$filename = date("d-m-Y");
$output = array();
$output = shell_exec("C:\wamp\bin\mysql\mysql5.6.12\bin\mysqldump.exe --user=".$db->username." --password=".$db->password." --host=".$db->hostname." --add-drop-database --add-drop-table --skip-extended-insert --disable-keys --add-locks --force --debug-info ".$db->databaseName." > ".$_SERVER['DOCUMENT_ROOT']."backups/".$filename.".sql");
//Write backup log
$file = fopen($_SERVER['DOCUMENT_ROOT']."backups/backup.log", "a");
fwrite($file, "\n\r".print_r($output, true)."\n\r");
fclose($file);
?>
這一切都完美的作品,以正確的格式創建一個SQL文件,但我不能爲我的生命寫入調試信息日誌,即使我有--debug-info
參數,該參數:
Print debugging information and memory and CPU usage statistics when the program exits.
如何正確地將此信息寫入到一個文件?
--debug [= debug_options], - #[debug_options] 編寫一個調試日誌。典型的debug_options字符串是'd:t:o,file_name'。默認值是'd:t:o,/ tmp/mysqldump.trace'。 – Hackerman
@RobertRozas我剛剛嘗試過,並且我在Apache錯誤日誌中使用了'mysqldump:ERROR:Option'debug ='d:t:o,/ backups/mysqldump.trace'',但已禁用' –
http:///www.mydigitallife.info/how-to-disable-and-turn-off-apache-httpd-access-and-error-log/ – Hackerman