Jump to content

Cannot instantiate non-existent class: ziparchive in /homepages/12/


adam291086

Recommended Posts

Why can't i use the class in this script, am i missing something?

 

 

<?php
     $zip = new ZipArchive;
     $res = $zip->open('myzipfile.zip');
     if ($res === TRUE) {
         $zip->extractTo('rubberduckiee files/');
         $zip->close();
         echo 'ok';
     } else {
         echo 'failed';
     }
?> 

 

you can see my php install info here http://www.rubberduckiee.co.uk/admin/FTP/code/info.php

i mean i can unzip and file like

 

<?php

function unzip($zip_file, $src_dir, $extract_dir)
{
copy($src_dir . "/" . $zip_file, $extract_dir . "/" . $zip_file);
chdir($extract_dir);
shell_exec("unzip $zip_file");
echo "unziped";
}

$file = $_SERVER['DOCUMENT_ROOT'].'/admin/FTP/code/zip/';
$filename = 'myzipfile.zip';
$dir = $_SERVER['DOCUMENT_ROOT'].'/admin/FTP/code/zip/rubberduckiee files/';

unzip($filename,$file,$dir);
?>

 

can i do something similar for zipping a folder?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.