I am using a php script to backup my database. Below is the given script:
$datestamp = date("Y-m-d_h-i-s"); // Current date to append to filename of backup file in format of YYYY-MM-DD
/* CONFIGURE THE FOLLOWING FOUR VARIABLES TO MATCH YOUR SETUP */
$dbuser = "xyz"; // Database username
$dbpwd = "*****"; // Database password
$dbname = "mydatabase"; // Database name. Use --all-databases if you have more than one
$filename = "backup-$datestamp.sql.gz"; // The name (and optionally path) of the dump file
$command = "mysqldump -u $dbuser --password=$dbpwd $dbname | gzip > $filename";
$result = system($command);
Below is the command line
php5 /var/www/vhosts/cc.astra1641.startdedicated.de/httpdocs/cron/backup.php
I have output the $result variable using var_dump to check it returns empty string. also I have tried using other methods like exec($command) or passthru($command), it doesn't work.