Skip to content

Redirecting to stdout

Ilya Evseev edited this page Dec 5, 2019 · 4 revisions

How to get output to stdout, so it can be redirected:

    include_once(dirname(__FILE__) . '/mysqldump-php/src/Ifsnop/Mysqldump/Mysqldump.php');
    $dump = new Ifsnop\Mysqldump\Mysqldump('mysql:host=localhost;dbname=testdb', 'username', 'password');
    $dump->start('php://stdout');

Send dump to client from web app:

    header('Content-Type: text/html; charset=utf-8');
    include_once(dirname(__FILE__) . '/mysqldump-php/src/Ifsnop/Mysqldump/Mysqldump.php');
    $dump = new Ifsnop\Mysqldump\Mysqldump('mysql:host=localhost;dbname=testdb', 'username', 'password');
    $dump->start('php://output');
Clone this wiki locally