If you have zziplib installed, you can use this code:
<?php
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
$zip->extractTo('/my/destination/dir/');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
Make sure the user running php (usually nobody, apache or httpd) has write permission on the destination directory.
source
share