Is there a script that can do a full remote backup?

Possible duplicate:
Suggestions for backing up php site and mysql db

Is there any php script that can back up the file system and back up the database (preferably zip them together) and send the backup to a remote server?

+4
source share
1 answer

Linux teams have better tools for this. you can access linux commands using the PHP exec () function. something like that:

// db $db_backup_file = '/home/backup/db_'.date('Ym-d').'.sql.gz'; $command = '/usr/bin/mysqldump -c -h'.DB_HOST.' -u'.DB_USER.' -p'.DB_PASS.' --default-character-set=latin1 -N '.DB_NAME.' | gzip > '.$db_backup_file; exec($command); // file structure $file_structure_backup_file = '/home/backup/files_'.date('Ym-d').'.tar.gz'; $command = 'tar -zcf '.$file_structure_backup_file.' /home/'; exec($command); 

you need to check linux command line options and then check and configure in a safe environment. you can then ftp or email files to wherever you are. or you can put the same stuff into cron work.

+2
source

Source: https://habr.com/ru/post/1334110/


All Articles