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

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.

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

报告相同问题?

悬赏问题

  • ¥20 怎么在stm32门禁成品上增加记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 解riccati方程组