Can't close zip file???

Topics: User Forum
Jan 22, 2008 at 2:53 PM
09:50:39 Create new PHPExcel object
09:50:39 Set properties
09:50:39 Add some data
09:50:39 Rename sheet
09:50:39 Write to Excel2007 format

Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file /home/crnorth/publichtml/newsite/SimpleExcel.xlsx.' in /home/crnorth/publichtml/newsite/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php:330 Stack trace: #0 /home/crnorth/publichtml/newsite/SimpleExcel.php(75): PHPExcelWriterExcel2007->save('/home/crnorth/p...') #1 {main} thrown in /home/crnorth/publichtml/newsite/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php on line 330
Jan 22, 2008 at 3:02 PM
Even trying to output to the browser didn't work:

Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file php://output.' in /home/crnorth/publichtml/newsite/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php:330 Stack trace: #0 /home/crnorth/publichtml/newsite/SimpleExcel.php(75): PHPExcelWriterExcel2007->save('php://output') #1 {main} thrown in /home/crnorth/publichtml/newsite/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php on line 330
Coordinator
Jan 22, 2008 at 4:52 PM
This is a known bug, which was fixed in the daily snapshot version (http://www.codeplex.com/PHPExcel/SourceControl/ListDownloadableCommits.aspx). PHPExcel 1.6.0 will include this fix.
Jan 22, 2008 at 7:55 PM

maartenba wrote:
This is a known bug, which was fixed in the daily snapshot version (http://www.codeplex.com/PHPExcel/SourceControl/ListDownloadableCommits.aspx). PHPExcel 1.6.0 will include this fix.


When will 1.6 be ready for download? Will this include the fix for the PrintArea question I asked earlier?
Coordinator
Jan 23, 2008 at 7:05 AM
PHPExcel 1.6.0 will be released somewhere in february. I applied this fix to the current 1.5.5 version which is available for download.

The printArea fix will be in 1.6.0, but is already available in the daily snapshot: http://www.codeplex.com/PHPExcel/SourceControl/ListDownloadableCommits.aspx
Mar 13, 2008 at 7:50 PM
I am receiving a similar error with 1.6.0

Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file /home/daniel/html/export.xlsx.' in /home/daniel/html/Classes/PHPExcel/Writer/Excel2007.php:349 Stack trace: #0 /home/daniel/html/export.php(76): PHPExcelWriterExcel2007->save('/home/daniel/ht...') #1 {main} thrown in /home/daniel/html/Classes/PHPExcel/Writer/Excel2007.php on line 349

Zip version 2.0.0
Libzip version 0.7.1

Coordinator
Mar 17, 2008 at 11:29 AM
Edited Mar 17, 2008 at 11:30 AM
Is the XLSX file actually created? Sounds like a permissions / PHP issue...

Can you try creating a ZIP file with ZipArchive class? http://nl.php.net/manual/nl/function.ziparchive-open.php
Apr 11, 2008 at 3:38 AM
I am getting a similar error:

21:36:52 Create new PHPExcel object 21:36:52 Set properties 21:36:52 Add some data 21:36:52 Rename sheet 21:36:52 Write to Excel2007 format
Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file /var/www/chrisberg/m11/Tests/03formulas.xlsx.' in /var/www/chrisberg/m11/Classes/PHPExcel/Writer/Excel2007.php:347 Stack trace: #0 /var/www/chrisberg/m11/Tests/03formulas.php(89): PHPExcelWriterExcel2007->save('/var/www/chrisb...') #1 {main} thrown in /var/www/chrisberg/m11/Classes/PHPExcel/Writer/Excel2007.php on line 347

I can create a ZipArchive... Any suggestions?
Jan 7, 2010 at 3:45 PM

I have the same problem, even with the exemple file "01simple.php"

16:37:43 Create new PHPExcel object 16:37:43 Set properties 16:37:43 Add some data 16:37:43 Rename sheet 16:37:43 Write to Excel2007 format

Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file /home/www/95d90c647b77a585884826a6c64199a7/web/intranet/phpexcel/Tests/01simple.xlsx.' in /home/www/95d90c647b77a585884826a6c64199a7/web/intranet/phpexcel/Classes/PHPExcel/Writer/Excel2007.php:400 Stack trace: #0 /home/www/95d90c647b77a585884826a6c64199a7/web/intranet/phpexcel/Tests/01simple.php(72): PHPExcel_Writer_Excel2007->save('/home/www/95d90...') #1 {main} thrown in /home/www/95d90c647b77a585884826a6c64199a7/web/intranet/phpexcel/Classes/PHPExcel/Writer/Excel2007.php on line 400

 

I'm using phpExcel 1.7.0

Have you got an idea how I can fix that?

Jan 13, 2010 at 2:35 PM
Edited Jan 13, 2010 at 2:39 PM

Had the same issue, until comparing 01simple.php and 01simple-dowloadxls.php found out that the majority of the tests write to Tests directory.

You need to make sure that the directory the examples are in is at least writeable by the user the webserver is running as.

The same applies if you're not making the file downloadable in your own project.

Jan 13, 2010 at 3:07 PM

yes, it works now,

 

thank you