I am trying to make a backup of a mysql database from php. The file is created but it's empty. I can't figure out why. This is the php script I use.
$db_host = 'localhost';
$db_name = '********';
$db_user = '********';
$db_pass = '********';
$conn = mysql_connect($db_host, $db_user, $db_pass)or die('Error connecting to mysql');
mysql_select_db($db_name);
$command = "mysqldump -u $db_user -p $db_pass $db_name > 'backupfile.sql'";
system($command);