title: Get mysqldump debug information
body: <p>I currently have a PHP ChronJob that makes a daily backup of my database, and the script is as follows:</p>
  
  <pre><code>&lt;?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-&gt;username." --password=".$db-&gt;password." --host=".$db-&gt;hostname." --add-drop-database --add-drop-table --skip-extended-insert --disable-keys --add-locks --force --debug-info ".$db-&gt;databaseName." &gt; ".$_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);
  ?&gt;
  </code></pre>
  
  <p>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 <code>--debug-info</code> argument which:</p>
  
  <blockquote>
    <p>Print debugging information and memory and CPU usage statistics when
    the program exits.</p>
  </blockquote>
  
  <p>How do I correctly write this information to a file?</p>