Want to archive a folder using tar from PHP:
$result = shell_exec("tar cf $sourceFile $sourceFolder -C $source > /dev/null; echo $?");
var_dump($result);
Output:
string(2) "2 "
the > /dev/null; echo $?
thing is for outputing the result code of a script under linux;
the -C $source
- changes to the right folder before doing anything
This is really strange because when i run this from linux console, it works just fine - creates the archive, so it's not a permission issue.
Other sripts like "whoami" or "ls" work fine.
Any ideas what does it mean?