adam291086 Posted September 5, 2008 Share Posted September 5, 2008 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 Link to comment https://forums.phpfreaks.com/topic/122848-cannot-instantiate-non-existent-class-ziparchive-in-homepages12/ Share on other sites More sharing options...
ranjuvs Posted September 5, 2008 Share Posted September 5, 2008 r u using PHP5. I think ZIPArchive is included from PHP5. Try printing out the phpinfo() and chk whether it is included Link to comment https://forums.phpfreaks.com/topic/122848-cannot-instantiate-non-existent-class-ziparchive-in-homepages12/#findComment-634440 Share on other sites More sharing options...
adam291086 Posted September 5, 2008 Author Share Posted September 5, 2008 i dont think my hosting company has the library installed to run it off php 4.4.9. Thanks Link to comment https://forums.phpfreaks.com/topic/122848-cannot-instantiate-non-existent-class-ziparchive-in-homepages12/#findComment-634443 Share on other sites More sharing options...
adam291086 Posted September 5, 2008 Author Share Posted September 5, 2008 what are the properties for using the shell comman ??? shell_exec("zip") Link to comment https://forums.phpfreaks.com/topic/122848-cannot-instantiate-non-existent-class-ziparchive-in-homepages12/#findComment-634450 Share on other sites More sharing options...
adam291086 Posted September 5, 2008 Author Share Posted September 5, 2008 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? Link to comment https://forums.phpfreaks.com/topic/122848-cannot-instantiate-non-existent-class-ziparchive-in-homepages12/#findComment-634453 Share on other sites More sharing options...
trq Posted September 5, 2008 Share Posted September 5, 2008 can i do something similar for zipping a folder? If your server has zip installed. Its not the typical compression application used on Linux. Link to comment https://forums.phpfreaks.com/topic/122848-cannot-instantiate-non-existent-class-ziparchive-in-homepages12/#findComment-634497 Share on other sites More sharing options...
adam291086 Posted September 5, 2008 Author Share Posted September 5, 2008 so i wont be able to do something similar? Link to comment https://forums.phpfreaks.com/topic/122848-cannot-instantiate-non-existent-class-ziparchive-in-homepages12/#findComment-634498 Share on other sites More sharing options...
trq Posted September 5, 2008 Share Posted September 5, 2008 Not unless your server has the zip program installed. You could of course use tar which offers a better compression algorithm but is unable to be unpacked by regular windows users using zinzip for instance. Link to comment https://forums.phpfreaks.com/topic/122848-cannot-instantiate-non-existent-class-ziparchive-in-homepages12/#findComment-634502 Share on other sites More sharing options...
adam291086 Posted September 5, 2008 Author Share Posted September 5, 2008 i am using a remote hosting company how can i find out if they have a zip client? and what info do i need to be able to use it within my script? Link to comment https://forums.phpfreaks.com/topic/122848-cannot-instantiate-non-existent-class-ziparchive-in-homepages12/#findComment-634510 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.