Well, according to the manual page for mysqldump you can specify the filename using the --filename option, but the main reason for my asking was to narrow down where the error is. If the few lines of code on the command window is the correct output, could it be the gzip part of the command? For example, do you have gzip installed on your Windows PC? If you type gzip at a windows command line, what happens?
The code you posted won’t output the sql dump to a file - it displays it on the console. Your php code, in the passthru() function, then passes that binary data out to the browser which, combined with the headers you’ve sent, is what I thought you wanted. Saving it to a temporary file might be another way around it, then redirect the user or send the file to the browser, but it seems to add a step for no good reason.
Getting that to work on the windows terminal is going to be a very painful experience. That command doesn’t work on WIndows at all. If your production machine is Linux based you should be running a Linux vm. You’re doing everyone a very big disservice developing for Xamp instead of your target environment which I assume isn’t a windows server. Xamp is really only adequate for basic development. Anything beyond that like executing Linux commands it isn’t useful for which is why you should be running a Linux vm instead. Anything you do to make that work with Xamp is going be specific to your own environment.
In general any Windows shell scripting will not work on a Linux server. Just as any Linux shell scripting won’t work on Windows. Windows and Linux are two completely different environments. I don’t know the answer to your question because I avoid those stupid problems by just using a vm. Xamp is garbage for anything beyond basic php programming.