Backup server files PHP -
i'm trying make script backup files in server folder gz compression..
what i'm doing tar files, gz compress them , print download link in html page download big file created.
it works guess works 0 300/400mb because err_empty_response
any idea how can manage better without using php system() or exec() functions? how keep connection alive? should chuck file? or what?
i post script
cheers
try { $memory_limit = ini_get('memory_limit'); ini_set('memory_limit', '1024m'); $name = str_replace(".","_",str_replace("www.","",$_server['server_name'])) .'_'. date('d-m-y_h-i'); $name_tar = $name .'.tar'; $name_gz = $name .'.tar.gz'; $backup = new phardata($name_tar); $backup->buildfromdirectory(dirname(__file__)); $backup->compress(phar::gz); unlink($name_tar); ini_set('memory_limit', $memory_limit); print "<a href='/".$name_gz."'>".$_server['server_name'].'/'.$name_gz."</a>"; } catch (exception $e) { echo "exception : " . $e; }
Comments
Post a Comment