Skip to content

Instantly share code, notes, and snippets.

@JunaidQadirB
Created January 15, 2015 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JunaidQadirB/2dda6fe54064c6167579 to your computer and use it in GitHub Desktop.
Save JunaidQadirB/2dda6fe54064c6167579 to your computer and use it in GitHub Desktop.
Compress Files on your host if you don't have cpanel or ssh
<?php
$time_stamp=time();
/*
* Set $archive and $directory path accordinging to your host
*/
$archive = "../tmp/backup_{$time_stamp}.tar";
$directory = "../html/";
print "starting...";
exec( "tar cf $archive $directory 2>&1 ",$retArr, $retVal);
// print_r($retArr);
// print_r($retVal);
exec( "gzip $archive 2>&1",$retArr, $retVal);
// print_r($retArr);
// print_r($retVal);
print "Done.";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment