Parag Chaure Parag Chaure - 11 months ago 65
PHP Question

Fatal error: Class 'ZipArchive' not found in

I have a problem that I install 'Archive_Zip 0.1.1' on Linux server, but when I try to run the script to create the zip file it gives the fatal error
"Fatal error: Class 'ZipArchive' not found in ---"
where I put the code

$zip = new ZipArchive;
$res = $zip->open($filename, ZipArchive::OVERWRITE);
if($res !== TRUE){
echo 'Error: Unable to create zip file';
//echo "<br>".dirname(__FILE__).$src;//'/install1';
echo 'Error: File not found';
echo "<br>file name ".$filename;

but it not found the class file.

Please tell me the solution what should I do to resolve the problem.
I also put php.ini file to the folder where script is, but it does not work.

Answer Source

For the ZipArchive class to be present, PHP needs to have the zip extension installed.

See this page for installation instructions (both Linux and Windows).