duankuai6991 2014-08-04 10:18
浏览 507
已采纳

PHPExcel在保存时生成500错误

I've just uploaded a set of code from my development server to my live one, and PHPExcel has started just generating a 500 error when i try to save anything. the code is below (Note: this all worked fine on the dev server, and both PHPExcel and Laravel work fine when transitioning between the two for other applications)

$PHPExcel = new PHPExcel;

$filename = 'Companies_Export_'.Session::getId().'.xls';
$file = public_path().'/_assets/exports/'.$filename;

//$fp = fopen($file, 'w');

$objWriter = PHPExcel_IOFactory::createWriter($PHPExcel, 'Excel5');
$objWriter->save($file);

I've removed the code to populate the file, in case it was a filesize issue.

I've used fopen to test if the application has write access to the directory, and that creates a new file with the correct name in the correct place, so that's fine too.

I've tried changing the file name to just '1.xls' so it's not an issue with Session::getId()

If i comment out the $objWriter->save($file); line, it all works fine, just obviously doesn't save, and if i put garbage in as the parameter instead of a legitimate directory/filename, it still just 500's, so indicating PHPExcel must be failing while compiling the file or something?

I'm at a loss now, no matter what i do it won't show me an error, it just throws a 500 page with no info (detailed error page just says php fastcgi process exited unexpectedly or similar)

Info: PHP version 5.3.10 Windows Server 2008 IIS 7.5

  • 写回答

1条回答 默认 最新

  • douhuocuo9012 2014-08-04 11:42
    关注

    The reason we don't get a useful error message is because PHP (process exited unexpectedly) itself crashes before beeing able to drop a note on the reason for its crash. Thus it can hardly be solved by PHP scripting due to PHP internal error.

    I am kinda certain that an upgrade to a newer PHP version will solve the issues.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭