Not clear what still needs doing.
I have this small bundle of php (zipTest.php)...
PHP Code:
<?php
$zip=new ZipArchive();
$files=array('a.txt', 'b.txt', 'c.txt');
$zipname='abc.zip';
if ($zip->open($zipname, ZipArchive::CREATE) !== TRUE) {die ('Could not open archive');}
foreach ($files as $file) {$zip->addFile($file) or die ('Could not add file');}
echo 'numFiles:', $zip->numFiles, '<br>status:', $zip->status;
$zip->close() or die ('<br>Could not close file');
?>
...in a virtually / locally hosted domain in my /home/directory....
Both /home/directory (drwxrwxr-x 2 homeUser homeUser) and zipTest.php (-rw-rw-r-- 1 homeUser homeUser) seem to have the requisite reads and writes in place to allow the abc.zip file to be built and written to the /home/directory (by the homeUser).
When I access zipTest.php via the browser (as homeUser), this is what appears...
Code:
numFiles:3
status:0
Could not close file
...showing (it seems) that the ZipArchive is created, three files (a, b and c) are added to it (numFiles:3) and that all is so far so good (status:0) - until zipTest.php fails to close (finish creating) abc.zip!
Thanks for any suggestions.
NB: I have also "777'ed" both the directory and php file, which I thought might address potential www-data / apache permissions issues - with the same results.
Bookmarks