It's possible that your web server is not emitting error messages, so I'd say check your error.log (should be hanging around in /var/log/apache2 or similar.) It might well be something trivial like not being able to write to a temporary file.
If that turns out as a dead-end, consider programmatically creating CSV files with echo statements - Excel will open those just fine.
EDIT
To produce CSV, do your headers
header('Content-Type: text/comma-separated-values);
header('Content-Disposition:attachment;filename="'.$filename.'.csv"');
header('Cache-Control: max-age=0');
Then output your column headers:
echo "col1,col2,col3,col4,..."
followed by a new line. Then output your data:
while(/*Still got some rows*/) {
echo $row[0] . "," .$row[1] "," + ...
}
Have a look at: http://en.wikipedia.org/wiki/Comma-separated_values, it's a really simple file format and Excel will open it without difficulty.
The other thing, which I hadn't thought of, is if you've got access to a Windows Server, you can produce Excel files directly via COM interop.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…