There are spaces where they are nessacary. That isnt the problem that exact code is working in dos and creating the file.
Here is a newer version which is just creating the blank file
<?php
include '../config.php';
$command = "path/to/mysql/mysqldump --opt -h".$config['dbhost']." -u".$config['user']." --password=".$config['pass']." ".$config['dbname']." > backup.sql";
passthru($command,$error);
if ($error) {
echo "Error: ". $error;
}
?>