On my Ubuntu 18.04 command-line, this works perfectly:
mysqldump --user="myuser" --password="mypassword" --skip-lock-tables --single-transaction --no-tablespaces mydb | gzip > /home/userhome/database_backup.sql.gz
So I create a PHP script having exact same (as a troubleshooting step):
exec("mysqldump --user=\"myuser\" --password=\"mypassword\" --skip-lock-tables --single-transaction --no-tablespaces mydb | gzip > /home/userhome/database_backup.sql.gz", $output, $worked);
switch($worked){
case 0:
echo "database backed up successfully";
break;
case 1:
echo "database back up failed";
break;
}
var_dump($output);
Script outputs:
database back up failed
array(0) { }
How do I resolve this especially with no useful error given in output?
Been through this and this but none of these apply. I have checked permissions and database access passwords and all seem ok.