title: Download file as csv when running script from command line
body: <p>When I run my php script from a browser, I get a csv file to automatically download to the client using <code>$fp = fopen('php://output', "w");</code>, <code>fputcsv</code> and the appropriate <code>header</code> tags. It works very nicely.</p>
  
  <p>When I run my script from the command line using <code>php index.php 2014</code> ("2014" being the argv I am passing in), then the contents of what would normally go in to the csv actually appears in the command line box.</p>
  
  <p>How can I get my code to still download a csv file when using the command line?</p>
  
  <p>If it matters I am running ubuntu using Vagrant and VirtualBox.</p>