mysqldump does not work in subdomain directory

I write a code that dump a mysql database into sql file and then compress it. It works fine when it runs in public_html directory in cpanel. But I have a subdomain and it has seperate directory like v2.saadapp.ir and my php script in that folder does not work and even do not get any error message.

`

here is my code

`include 'key.php';
$fileName='backups/db_backup4_'.date('Y-m-d_H-i-s').'.sql';

  $cmd='/usr/bin/mysqldump --user='.$dbuser.' --password="'.$dbpass .'" --host=localhost '.$dbname.' > '.$fileName .'  2>&1';

//var_dump($cmd);exit;

exec($cmd, $output, $return);

if ($return != 0) { //0 is ok
var_dump($result);
echo "<br />";
var_dump($output);
echo "<br />";

    die('Error: ' . implode("rn", $output));

}

function mkZip($inputfile){

    // echo '<br>'.$inputfile;

$zip = new ZipArchive;

$res = $zip->open('backups/bkup_'.date('Y-m-d_H-i-s').'.zip', ZipArchive::CREATE);

if ($res === TRUE) {

    $fileContent=file_get_contents($inputfile);

    $zip->addFromString($inputfile, $fileContent);

    $zip->setEncryptionName($inputfile, ZipArchive::EM_AES_256, 'passw0rd');

    $zip->close();

    echo $inputfile.' ok';

    unlink($inputfile);

} else {

    echo 'failed';

}

}



mkZip($fileName);