Page 1 of 1

Unable to uncompress tar.gz files in ftp

Posted: Fri May 12, 2006 5:14 pm
by nadeembabar
HI,
I am trying to uncompress some tar.gz compressed files. I used the following code:

Code: Select all

<?php
$output = shell_exec('tar zxvf news.tar.gz');
echo "<pre>$output</pre>";
?>
The result in browser showing all files uncompressed. But when I check my ftp its empty. I also tried it by using back ticks but no result. I've a shared hosting plan without shell access so it is not possible for me to uncompress files by using the shell prompt.

Can some one help to sortout this problem. Is there a way to uncompress tar.gz files by using php script?

Thanks
Nadeem

Posted: Fri May 12, 2006 5:47 pm
by pickle
To send arguments to tar, or any other *nix command, you need a dash first:

tar -zxvf news.tar.gz

Also, using the [syntax="php"][/syntax] tags rather than [syntax=php][/syntax] will highlight your PHP code a little nicer ;)