Adi Bradfield
Adi Bradfield

Reputation: 2093

Get mysqldump debug information

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, "\n\r".print_r($output, true)."\n\r");
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?

Upvotes: 0

Views: 2405

Answers (1)

RandomSeed
RandomSeed

Reputation: 29779

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).

Upvotes: 1

Related Questions