Archive_Tar
The Archive_Tar PEAR class allows you to create and work with tarballs from within your PHP scripts.

Creating a new Tarball
<?php
    require_once('Archive/Tar.php');

    /* Create a new tarball */    
    $tar = new Archive_Tar('mytarball.tar.gz', true);
    $filelist = array('file1.txt', 'file2.txt', 'file3.txt');
    $tar->add($filelist);
    
?>