0

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

11
  • When you open the file for writing, and then PHPExcel tries to write the file, it might be locked. Please don't let us guess the problem and lookup the exact error from the log files.
    – Daniel W.
    Aug 4, 2014 at 10:20
  • laravel.log contains no information on the particular error
    – Ben Green
    Aug 4, 2014 at 10:22
  • 2
    laravel log? Look in PHP error log. With fpm on debian it's in /var/log/php5-fpm.log, with apache it's in /var/log/httpd/error.log or /var/log/apache/error.log etc
    – Daniel W.
    Aug 4, 2014 at 10:24
  • 1
    changed it to be using syslog instead, so the logged error is: Faulting application name: php-cgi.exe, version: 5.3.10.0, time stamp: 0x4f2ae019 Faulting module name: php5.dll, version: 5.3.10.0, time stamp: 0x4f2ae082 Exception code: 0xc0000005 Fault offset: 0x00091818 Faulting process id: 0x17cc Faulting application start time: 0x01cfafd2bd36811f Faulting application path: C:\Program Files (x86)\PHP5310\php-cgi.exe Faulting module path: C:\Program Files (x86)\PHP5310\php5.dll Report Id: 08be4c4f-1bc7-11e4-a09c-001cc4e2ea5c
    – Ben Green
    Aug 4, 2014 at 11:05
  • 1
    I think it's a windows+php problem, combination of command lead to those errors. "I updatet my php form 5.3.10 to 5.3.12 and problem was solved." (searched for 'Fault offset: 0x00091818').
    – Daniel W.
    Aug 4, 2014 at 11:11

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.