tags:

views:

43

answers:

2

Hi,

I have been wondering for couple of days: Is there a way to extract files from a .tar.gz archive in PHP without resorting to calling system commands with system()? (So: either with a built-in classes/functions or using an external free library?)

I need it to work both on Windows (development) and Linux (deployment), if possible.

Thank you.

+1  A: 

I've found this link on Google.

Evert
+3  A: 

The http://pear.php.net/package/File_Archive package from PEAR sounds like it would do what you want.

Bill Karwin
The File_Archive manual was not the best and I needed to change some lines in it so it does not throw errors under PHP 5.3, but ultimately, calling File_Archive::extract(File_Archive::read('archive.gz/'), $dest = '../extracted') did the job. Thanks Bill, and everyone else who was trying to help.
michalstanko