views:

1246

answers:

2

So I have a client who's current host does not allow me to use tar via exec()/passthru()/ect and I need to backup the site periodicly and programmaticly so is there a solution?

This is a linux server.

+3  A: 

There is the Archive_Tar library. If that can't be used for some reason, the zip extension might be another option.

Martin v. Löwis
You posted while I was typing but I'll keep mine here since it has the code.
Unkwntech
+3  A: 

At http://pear.php.net/package/Archive_Tar you can donload the PEAR tar package and use it like this to create the archive:

<?php
require 'Archive/Tar.php';
$obj = new Archive_Tar('archive.tar');
$path = '/path/to/folder/';
$handle=opendir($path); 
$files = array();
while(false!==($file = readdir($handle)))
 {
    $files[] = $path . $file;
 }

if ($obj->create($files))
 {
    //Sucess
 }
else
 {
    //Fail
 }
?>
Unkwntech