I'm trying to have MySQL backup through mysqldump and the command works in the command-line but it returns 2 from exec().
Here's the code I'm using:
$filename = "/path/to/backup/dbBackUp".date("Y-m-d").".sql";
$backupcmd = "/usr/bin/mysqldump -u USERNAME -pPASSWORD -A --single-transaction >".$filename;
exec($backupcmd, $output, $return);
Vardump of $output is array(0) { } and $return = 2.