-1

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

David
  • 166
  • 1
  • 10
No One
  • 109
  • 10

1 Answers1

1

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.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149