I am trying to write a php script that will backup all my databases. However, this isn't working:
<?php
$host = 'myhost';
$user = 'myuser';
$pass = 'mypassword';
$backupDir = "/home/user/www/mysqlbackups";
$backupFileName = "backup.sql";
$back = $backupDir.$backupFileName;
system(sprintf("mysqldump --all-databases -h %s -u %s -p%s > %s",$host,$user,$pass,$back));
?>
I have also tried adding "or die (mysql_error());" to the end of the command, but I do not get any error message from this. However, if I try to echo something after the die statement, then it does echo...so I don't know what that means.
Anyway, I am a real newbie at this, so all help would be appreciated. Thank you very much!