ZipArchive error

Topics: User Forum
Feb 2, 2009 at 11:02 AM
Could anyone help me with this error?

I am using PHP version 5.2.8
php_zip is enabled and working

Warning: ZipArchive::getFromName() [ziparchive.getfromname]: Invalid or unitialized Zip object in /home/footwear/public_html/admin/PHPExcel/Reader/Excel2007.php on line 205

Warning: Invalid argument supplied for foreach() in /home/footwear/public_html/admin/PHPExcel/Reader/Excel2007.php on line 206

Fatal error: Call to a member function getDrawingCollection() on a non-object in /home/footwear/public_html/admin/stock_upload.php on line 365
Coordinator
Feb 2, 2009 at 12:22 PM
Check the FAQ page, PHP 5.2.8 contains a bug in ZipArchive... The version that can be found on http://snaps.php.net/win32/php5.2-win32-latest.zip should work at all times.
Feb 2, 2009 at 9:15 PM
Is there a fix or workaround?
Coordinator
Feb 3, 2009 at 8:52 AM
The fix is to download and install the correct version of php_zip
Developer
Feb 3, 2009 at 2:28 PM
Edited Feb 3, 2009 at 3:56 PM
@maartenba, @MarkBaker: Is there also a problem with Excel 2007 reader with defect zip extension? Also it looks like this is Linux and not Windows. I think it may not be the zip extension bug.

@xquex: If it is still not working, can you send us the Excel file so we can inspect? (erik at phpexcel dot net)

Coordinator
Feb 3, 2009 at 4:11 PM
Zip extension may be the error here too. Reader and writer make use of it.
Mar 12, 2009 at 11:56 AM
Sorry to add new content to an old thread, but I am getting the same kind of error error as xquex.

Warning: ZipArchive::getFromName() [ziparchive.getfromname]: Invalid or unitialized Zip object in E:\workspace\projectTesting\PHPExcel\Reader\Excel2007.php on line 206

Notice: Trying to get property of non-object in E:\workspace\projectTesting\PHPExcel\Reader\Excel2007.php on line 207

Warning: Invalid argument supplied for foreach() in E:\workspace\projectTesting\PHPExcel\Reader\Excel2007.php on line 207

Notice: Undefined offset: 0 in E:\workspace\projectTesting\PHPExcel.php on line 162

Fatal error: Call to a member function getRowIterator() on a non-object in E:\workspace\projectTesting\index001.php on line 15

I have followed the instructions you have given in order to resolve the problem but I am still getting the error.
I am working with wamp 5.2.8 and I have enabled php_zip extension. I changed the php_zip.dll file several times first with the one indicated by maartenba and then I tried with the one from php 5.2.9 but in
either cases it didn't work. I got the error while trying to test the code on page 9 of  PHPExcel developer documentation.doc. Please help.
Developer
Mar 13, 2009 at 2:24 PM
@victoroancea: You are getting those errors while trying to read an xlsx file? Do you have the chance to test on Linux? This will help determining whether this is a server installation problem or not.

Mar 16, 2009 at 11:08 AM
Yes I am getting the error while trying to read a file named testing001.xls that contains only some numbers that I put in it for testing while running the code on page 9 of  PHPExcel developer documentation.doc. No I am working on Windows with Wamp server and I do not have the possibility to test it on Linux.
Developer
Mar 16, 2009 at 2:30 PM
@victoroancea: Can you try to run the sample scripts located in the Tests folder and see if you get similar errors?

Mar 17, 2009 at 1:20 PM
ok I tried the first 15 examples in the Tests folder and they work. However the example from the developer documentation still does not.
Developer
Mar 17, 2009 at 4:20 PM
@victoroancea: Can you try to post your code as I'm not sure what example you are trying. If the examples in the Test folder are working, it's probably not a server installation problem.

May 2, 2010 at 2:13 PM

I have the same error and successor to the file you want to read is protected by a password. how do I place it password to read it, the password is what it is.

Jul 15, 2010 at 8:22 PM
Old thread but shows up high in Google now so I just wanted to add that I got similar errors as xquex and victoroancea and realized I was only getting those errors on XLS (97-2003) files and not getting them on XLSX (2007) files. Just a thought to try both versions if you are getting this error to see if it is version specific.