Hope this could help..
In some server configuration an associative array doesn't work. In my case the script stops without any error or message, just fputcsv return "false".
Diggin'n'Debuggin I found that in my local setup associative arrays works, but on live server not. Just removing keys solved the problem.
So, it's better to strip keys before calling fputcsv()
<?php
// Remove keys from an array
$csv_fields = array();
foreach($associative_array as $value) {
$csv_fields[] = $value;
}
fputcsv( $handler, $csv_fields);
?>