Mysql转储空文件

I tried to follow the many guides online to create a script that makes a backup of SQL database, but unfortunately I find myself with an error in the SQL command because I go to create a file is where I say, and as I say, but it is completely empty ..! The syntax that use is as follows:

exec('mysqldump –opt -user=' . $db_user . ' -password=' . $db_pass . ' --host=' . $db_host . ' ' . $db_nome . ' > ' . $db_filename);

and this:

exec('mysqldump --user=' . $db_user . ' --password=' . $db_pass . ' --host=' . $db_host . ' ' . $db_nome . ' > ' . $db_filename);
echo 'mysqldump –opt -user=' . $db_user . ' -password=' . $db_pass . ' --host=' . $db_host . ' ' . $db_nome . ' > ' . $db_filename;

You see mistakes?

You have to specify full path to mysqldump:

exec('/usr/bin/mysqldump –opt -user=' . $db_user . ' -password=' . $db_pass . ' --host=' . $db_host . ' ' . $db_nome . ' > ' . $db_filename);