I wanted to have database backup cron in webserver, I use following codes to output sql file:
<?php
include('connectdb.php');
$backupFile = 'database_backup_'.date("YmdHis").'.sql';
$command = 'mysqldump $dbname --password=$dbpass --user=$dbuser --single-transaction >'.$backupFile;
system($command);
include('closedb.php');
?>
but when I open the specific sql file, its only show text like this:
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help
What's wrong with my code?
Thanks.