Hi,
So far, last Friday, every file file I try and open and unzip with
the ZipArchive class has failed.
I have just used ZipArchive to create a zip file and then
attempt to unzip it.
Even this has failed.
Does this means that my server ZipArchive class is somehow corrupted ?
Should I reinstall that php class ( I think it is via PECL )
Or is there another reason ?
here is my script for creating the zip file
and then unzipping it.
( Because I am trying to trap every error it is longer than usual )
And YES the file "aaa_new.zi p" does get created on
my server.
This is the log output:
Any ideas ?
So far, last Friday, every file file I try and open and unzip with
the ZipArchive class has failed.
I have just used ZipArchive to create a zip file and then
attempt to unzip it.
Even this has failed.
Does this means that my server ZipArchive class is somehow corrupted ?
Should I reinstall that php class ( I think it is via PECL )
Or is there another reason ?
here is my script for creating the zip file
and then unzipping it.
( Because I am trying to trap every error it is longer than usual )
Code:
$new_zip = $file_dir.'aaa_new.zip'; if (!class_exists('ZipArchive')) { write_log("Class ZipArchive not found\r\n"); exit; } else { write_log("Class ZipArchive OK\r\n"); $zip = new ZipArchive; } $res = $zip->open($new_zip, ZipArchive::CREATE); if ($res === TRUE) { $zip->addFromString('data1.txt', 'file content goes here'); $fin = $zip->close(); if ($fin === TRUE) { write_log("Created zip file: $new_zip\r\n"); } else { write_log("Error on close: $fin \r\n"); exit; } } else { write_log("Could NOT Create zip file $res\r\n"); } if (!$new_zip) { write_log("Could not find $new_zip\r\n"); exit; } else { write_log("Found: $new_zip\r\n"); } $zip = new ZipArchive; $res = $zip->open($new_zip); if ($res === TRUE) { write_log("File $new_zip OPENED\r\n"); } else { write_log("Could not open $new_zip\r\n Error # $res\r\n"); exit; } if ($zip->extractTo($file_dir) === TRUE) { write_log("Extracted: $new_zip\r\n"); $zip->close(); } else { write_log("Extraction error\r\n"); } $zipSS = $zip->getStatusString(); write_log("StatusString: $zipSS\r\n"); $fin = $zip->close(); if ($fin === TRUE) { write_log("Unzipped file to: $file_dir\r\n"); } else { write_log("Error on close: $fin \r\n"); exit; } exit;
my server.
This is the log output:
Class ZipArchive OK
Created zip file: /home/gudfrt/public_html/stres/aaa_new.zip
Found: /home/gudfrt/public_html/stres/aaa_new.zip
File /home/gudfrt/public_html/stres/aaa_new.zip OPENED
Extracted:/home/gudfrt/public_html/stres/aaa_new.zip
StatusString:
Error on close:
Created zip file: /home/gudfrt/public_html/stres/aaa_new.zip
Found: /home/gudfrt/public_html/stres/aaa_new.zip
File /home/gudfrt/public_html/stres/aaa_new.zip OPENED
Extracted:/home/gudfrt/public_html/stres/aaa_new.zip
StatusString:
Error on close:
Any ideas ?
Comment