0

Would anyone know how to extract 7z archive on linux web hosting. I am currently using the code below to unzip .zip files, but this does not work for .7z

// Unzip File 

$zip = new ZipArchive;
if ($zip->open($userPath . 'import.7z') === TRUE) {
$zip->extractTo($userPath);
$zip->close();

} else {
echo 'failed';
}
Santosh Pillai
  • 1,311
  • 1
  • 20
  • 31

1 Answers1

1

The 7z file format can use various compression algorithms, so you might be able to decompress the archive with one of the existing utilities for bzip2 or deflate.

You will likely need to use a library such as this one though. Here is the latest version.

Robadob
  • 5,319
  • 2
  • 23
  • 32
  • how do i use this file on the server? do you have any example commands? – Santosh Pillai Jul 29 '13 at 11:15
  • You will need to include the file with require_once or include etc, and then just look through the file in your editor, its comments are pretty documenting they explain how to use it. – Robadob Jul 29 '13 at 16:23
  • The link for this is dead. I've been looking for this for ages now but none of the links work! Please reupload! – hedgehog90 Sep 21 '15 at 10:57