tags:

views:

273

answers:

3

Can any one please let me know, why this following error has been thrown from PHPExcel classes

    Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file
 /var/www/mydomain/myexcel.xlsx.' in /var/www/mydomain/Classes/PHPExcel/Writer
/Excel2007.php:400 Stack trace: #0 /var/www/mydomain/myexcel.php(173):
 PHPExcel_Writer_Excel2007->save('/var/www/mydomain...') #1 {main} 
thrown in /var/www/mydomain/Classes/PHPExcel/Writer/Excel2007.php on line 400
A: 

The exception is being thrown because PHPExcel has opened the zip file for writing the Excel workbook; but when it tries to close it again on completion, the zip library method call to close() has failed. Why it has failed is the real problem, and that can't be resolved simply by knowing the error message.

Mark Baker
+1  A: 

My educated guess would be that this is due to the fact that the permissions on the folder you're trying to write to are wrong. If that's the case, either make the folder writable (which, from the looks of it would be a bad idea) - or try to save to a location where the web user has write access to solve the problem.

BTW What version of PHPExcel are you using?

wimvds
Thanks for the idea: I'll run some tests... might then be able to do a permissions test before writing and throw a more meaningful exception
Mark Baker
A: 

I hope this exception may occur because of the Excel sheet is still in open state. also please check with the permission of the folder in which you write/save/upload the .xlsx file.

VAC-Prabhu
yes the file extension is wrongly given
Chakrapani