douxin2011
douxin2011
2013-08-01 15:50
浏览 52
已采纳

获取mysqldump调试信息

I currently have a PHP ChronJob that makes a daily backup of my database, and the script is as follows:

<?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, "
".print_r($output, true)."
");
fclose($file);
?>

It all works perfectly, creating an SQL file in the correct format, but I cannot for the life of me write the debug information to a log, even though I have the --debug-info argument which:

Print debugging information and memory and CPU usage statistics when the program exits.

How do I correctly write this information to a file?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongzi9196
    dongzi9196 2013-08-01 16:09
    已采纳

    This option simply does not seem to be working on Windows. I am not surprised, because these informations are less readily available on this system than on Linux, and the MySQL folks perhaps didn't bother porting this little used option.

    On Linux, the debug information is sent to stderr (you would typically capture this info with a 2>debug.log redirection).

    点赞 评论

相关推荐