0
$command = 'mysqldump.exe -u '.$username.' '.$database . '  > '.$location.'\\'.$filename;
system($command);

this can create sql file correctly.

Now i'm trying to create compressed backup.

$filename = "xyz.sql.gz";
$command = 'mysqldump.exe -u '.$username.' '.$database . ' |gzip > '.$location.'\\'.$filename;
system($command);

This is creating a gz file with zero byte size.

please help, where im am doing wrong.

I didnot put -p[password] as the user i used is without password. Thanks in advance.

2
  • Paste the raw command without the php.
    – Peter
    Commented Apr 10, 2015 at 8:04
  • Actually I'm using a batch file CLS C: cd/ cd C:\wamp\bin\mysql\mysql5.5.24\bin\ mysqldump.exe -u root soncology > C:\wamp\www\MedicalHistory\system\soncology.sql above code is working perfect for sql file. now i want compressed backup using this batch file. what r the changes i should make. thanks for response.
    – Mushariar
    Commented Apr 10, 2015 at 10:07

1 Answer 1

1

Are you missing Gzip application on windows? or is it in PATH or in same directory than script?

3
  • Thanks for response. I am using WAMP. From wamp export menu I can backup gzip compressed dump. so gzip should be on my windows. Do I need to install it separate?
    – Mushariar
    Commented Apr 10, 2015 at 10:05
  • Other applications can use gzip as zipping format. Open cmd.exe and try gzip, might be that you need to install it or something equivalent. I do not know what WAMP contains.
    – Synomi
    Commented Apr 10, 2015 at 10:31
  • Solved. yeah. I had to copied to gzip.exe to my php folder.
    – Mushariar
    Commented Apr 10, 2015 at 11:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.