ZipArchive headache
| From: | Jeffry Killen | Date: | Tue, 05 May 2015 21:53:59 +0000 |
| Subject: | ZipArchive headache | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-324864@lists.php.net to get a copy of this message | ||
I have held off on posting this pending an implementation of a script that uses a formal
synchronous POST strategy, AND IT WORKED.
So there are now two "gotcha's"
1: ZipArchive won't create an empty zip file, but will return a positive result
2: Apparently, after the exercise below: A zip file will not be created using
an async request. And will give the persistent result as below. That is
the common link in all the different dev server installations.
----The message as I originally composed and saved as a draft---------
I have been struggling with this and am continuously running up against this wall;
1: I originally was get ZipArchive::CREATE to work on iMac (Mac OSX w/Apache) as
local dev server.2: This machine began giving me the ominous click of death (hard drive about to bail out) sounds.
So I switched to another Mac with Yosemite, (Latest OSX version) thinking that a newer version of
php would be installed.
I got the same story. The code below is also wrapped in a class def. That is when I started getting
the error code, and that is why I tried to isolated it to get it to work again.
3: I also go a new Mac Mini and switch to that thinking maybe a newer version of php:
Same story.4: Meanwhile back at the iMac, the hard drive was not about to cr*p out. The clicking
sounds must have been coming from stereo system playing percussion instruments5: So now I am back at the iMac where I was able to get the code to work originally. And now I am getting the same @#$!! story. The calls to header, print, and exit are in response to async get queries. $_constER is an array I culled from the various error codes according to the documentation. else if($_GET['newArchAlt'])
{
//header('Content-Type: text/plain');
//print $_GET['newArchAlt'];
//exit;
require_once("php/zpArchConst.php");
//$_constER;
$_alt = new ZipArchive();
$_ret = $_alt->open(getcwd().'/'.$_GET['newArchAlt'], ZipArchive::CREATE);
header('Content-Type: text/plain');
print $_ret.': '.$_constER[$_ret].": ".$_GET['newArchAlt']; // result appears below
exit;
The result as printed in the initiating page:
1: ZipArchive::ER_MULTIDISK|Multi-disk zip archives not supported: test-2.zip
So, essentially the same code on three different machines, when one initially
was working.
I don't know if anyone has a suggestion. I have posted about this issue several weeks ago
and the suggestion that I try deleting the file before trying to create it. But I still get the same
story, and it doesn't exist before trying to create it.