开发者

PHPExcel $objWriter->save() fails

I am creating an Excel file based on records from a database with PHPExcel and am facing an odd problem when generating it on a large data set. I have narrowed it down to a single problem-causing line:

$objWriter->save('php://output');

It just spits out a blank file instead of the expected workbook. Also, the effect is similar if I try to save the result into a local file instead of redirecting to the browser - no file is ever created.

The kicker is that it works perfectly for a smaller data set (smaller = up to 200 rows, larger = up to 2000 rows, up to 20 columns in both cases). It also works fine on another (development) server with an EXACT SAME, 100% identical, large dataset.

I do have the save() call wrapped in a try-catch but no exception is raised. Executing memory_get_peak_usage() right before going for save() tells me that it was using 24MB, and I have ini_set('memory_limit', '-1') earlier in the script. Also, monitoring memory usage on the server while running the script does not show any significant increase either.

Any tips for debugging it?

Edit: there are no errors in apache logs, however I did notice that the relevant line in access logs says:开发者_StackOverflow中文版

10.1.1.1 - - [01/Jun/2011:08:35:03 -0400] "GET /get_excel.php HTTP/1.1" 200 16386

The odd part is the last column - size. The file I actually get to download is always empty - exactly 0 bits, not 16386.


Based on the feedback you gave in the comments I think you do not meet all the requirements. You can find the list of the requirements here on the phpexcel website.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜