Before you say there are other questions like this, but none of the answers I've seen worked, so I'm making a fresh question.
I'm trying to use mysqldump
via system()
with this command:
$backup_path = $_SERVER['DOCUMENT_ROOT'] . '/website/acp/backup/';
$backup_name = $backup_path . $dbname . '.backup.' . date('l.dS.F.Y.g.iA') . '.sql';
$command = 'mysqldump ' . $dbname . ' -u ' . $dbuser . ' -p' . $dbpasswd . ' > ' . $backup_name;
system($command, $returned);
print_r($returned);
$returned
outputs 127
and a blank file with a size of zero KB is located in the backup folder, now when I echo $command
and then enter it into Terminal, it works perfectly and generates a full backup of the database. This is the part I don't understand, why is it not working well in the system()
call but in Terminal it works just fine?