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?