php code in FTP to backup db using URL
Posted
by
Giom
on Stack Overflow
See other posts from Stack Overflow
or by Giom
Published on 2012-07-07T20:53:09Z
Indexed on
2012/07/07
21:15 UTC
Read the original article
Hit count: 215
I fund and inserted this code in my FTP in a backup.php that works great but it copy the file into the root folder (homez/)
1- I would like to put these backup files in a homez/backupDB any idea where to put this path?
2- the db backup files (DB.sql.bz2) have always the same name, is it possible to name each one with the date of creation? (I launch this php with the URL link)
<?
echo "Votre base est en cours de sauvegarde.......
";
$db="nom_de_ma_base";
$status=system("mysqldump --host=mysql5-1.perso --user=$_POST[login] --password=$_POST[password] $db > ../$db.sql");
echo $status;
echo "Compression du fichier.....
";
system("bzip2 -f ../$db.sql");
echo "C'est fini. Vous pouvez récupérer la base par FTP
\n
";
?>
Thanks!
© Stack Overflow or respective owner