Unable to uncompress tar.gz files in ftp

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nadeembabar
Forum Newbie
Posts: 4
Joined: Fri May 12, 2006 5:04 pm

Unable to uncompress tar.gz files in ftp

Post 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
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post 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 ;)
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply