mysqldump sql file save without content

123 Views Asked by At

i have this php script.when i run the script mysqldump, The file got saved but the content is empty. Any help is appreciated.

thank you.

$filename = "backup-" .  date("YmdHis") .  ".sql";
$pathfile = public_path('database') .'/' .$filename;

exec('mysqldump -u'.env('DB_USERNAME').' -p'.env('DB_PASSWORD').' '.env('DB_DATABASE'). ' > ' . $pathfile);

echo 'done';

No Error is printing, But the file is empty

1

There are 1 best solutions below

0
On BEST ANSWER

You need to make sure that the mysqldump processor is in a folder that is on your PATH or you have to add the complete path to the mysqldump processor to the PHP call to the processor.