I have done something like this in a cron job PHP script before. Not sure if it is the best way, but it certainly works.
$backup_file = '/home/example/sql_backup/mo_'.date('Y-m-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 > '.$backup_file;
exec($command);
You could then exec an sftp to the remote server.
You could do the file folders similarly using exec() and linux zipping.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…