I am using this command in wamp, but I am getting empty Mybackup.sql file, did my knows what I am missing?
<?php exec("pg_dump -U postgres taro-api > Mybackup.sql"); ?>
With the additional information from the comments, it becomes clear that you are on Windows and pg_dump is not on your PATH.
Either use the full absolute path for pg_dump or add the directory to the PATH environment variable.
\"C:\\Program Files\\PostgreSQL\\10\\bin\\pg_dump\" -U postgres -d taro-api -f Mybackup.sql.exec argument, do away with the backslashes escaping the double quotes.exec('"C:\\Program Files\\PostgreSQL\\10\\bin\\pg_dump" -U postgres -d taro-api -f Mybackup.sql 2>&1').
2>&1to the command, then the error message will be added to the output. That should help. Perhapspg_dumpis not on thePATH.