Automated MySQL backup
I'm trying to schedule a mysql backup from cron. The job runs (not a cron) problem, but the mysqldump is empty. The script I'm running in in php, has permissions of 755, and I'm on a shared hosting plan (pro).
Here's a snippet of code with the command I'm trying to execute. In the example below $message is always null and $retval is 0.
Are we allowed to run exec() or system() from php? Perhaps that is my problem. if not, is there a way for me to accomplish this in some other way, like a Perl script or something?
$command = "mysqldump -u{$dbUsername} -p{$dbPassword} $dbName | gzip > $backupPath";
$message = exec($command, $output, $retval);
echo "$backupFile :: $message :: $retval";
Here's a snippet of code with the command I'm trying to execute. In the example below $message is always null and $retval is 0.
Are we allowed to run exec() or system() from php? Perhaps that is my problem. if not, is there a way for me to accomplish this in some other way, like a Perl script or something?
$command = "mysqldump -u{$dbUsername} -p{$dbPassword} $dbName | gzip > $backupPath";
$message = exec($command, $output, $retval);
echo "$backupFile :: $message :: $retval";