Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPExcel exception: "Could not close zip file ... "

Tags:

phpexcel

I am using XAMPP a Mac for local development, but I used this code at work (using Windows and an otherwise identical development environment) and it worked fine:

$objPHPExcel = new PHPExcel();
$sheet       = $objPHPExcel->createSheet();
$sheet->fromArray($a);
...
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
//$objWriter->save('P:/Projects/Mess3/Sadness.xlsx');
$objWriter->save('/Users/tjb1982/Desktop/sadness.xlsx');

The commented-out text works with my Windows system at work. I tried to output the file to 'php://output' and got a garbled mess (is that what is to be expected?).

I can't seem to find anyone who is experiencing this problem outside of those who had permissions problems or had the file open when they were trying to save it. Please help!

like image 605
tjb1982 Avatar asked Aug 15 '11 17:08

tjb1982


1 Answers

I was getting the same error "Cannot close zip file.." and realized it didn't have permissions to write to that directory. Check your write permissions. (IIS8 + php + mysql + oracle)

Once i allowed write permissions problem was immediately fixed.

like image 104
TechnIckS Avatar answered Oct 12 '22 15:10

TechnIckS