Help using tar through php

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm trying to tar some files with PHP but can't get it to work.
From a linux command line I can use

Quoted text here. Click to load it

and it runs down the home tree creating the archive,
but if I put this into a php file as:

exec("/bin/tar -cvzf myfile.tgz /home/",$arrayout,$returnval);

All I get is returnval = 2
I've tried using system and passthru with the same result.
I can't see anything there that needs escaping.
I can't find any reference to a return value of 2 and arrayout  
doesnt contain any help.
I'm out of ideas.

can anyone tell me how to do this please?
thank you


Re: Help using tar through php wrote:
Quoted text here. Click to load it

Append this:

for ($i = 0; $i < count($arrayout); $i++) {
        echo $arrayout[$i] . "\n";

and see what the command output is.


Site Timeline