Re: Backing up the database via browser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, 11 Nov 2002, David Busby wrote:

> Zavier,
>     Using PHP You can do a ``, shell_exec, or passthru to run another
> process, (search for the word "exec" on php.net).  Using that and PostgreSQL
> command pg_dump you can pull it off, might take a while, here's some
> untested code with no error checking
> 
> <?php
> $db = $_GET['db'];
> $cmd = "pg_dump -c -D -f /tix/miner/miner.sql -F p -N -U postgres $db";
> $res = `$cmd`;
> // Alternate: $res = shell_exec($cmd);
> echo $res;
> ?>

He might need to start the $cmd with "/path/to/pg_dump...

unless the pgsql path is in httpd's path.



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux