You are here: Re: Help using tar through php « PHP Programming Language « IT news, forums, messages
Re: Help using tar through php

Posted by Chris Parker on 11/26/21 11:57

nigel.t@by.uk wrote:
> I'm trying to tar some files with PHP but can't get it to work.
> From a linux command line I can use
>
> >tar -cvzf myfile.tgz /home/
>
> and it runs down the home tree creating the archive,
> but if I put this into a php file as:
>
> <?php
> 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
>
> -nigel-

Append this:

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

and see what the command output is.

Chris

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация