ifsnop / mysqldump-php

PHP version of mysqldump cli that comes with MySQL
https://github.com/ifsnop/mysqldump-php
GNU General Public License v3.0
1.25k stars 300 forks source link

Is it possible to get the output line by line #260

Closed cyberpunkbln closed 1 year ago

cyberpunkbln commented 1 year ago

Hello, is it possible to get the output line by line? In the moment store the output with output streaming into an variable:

ob_start();
$dump->start('php://output');
$dump = ob_get_contents();
ob_end_clean();

But i want to receive the output line by line, where i can alter the line and save money. thx

ifsnop commented 1 year ago

Hi, output is already done line by line. Maybe you need to disable server buffering (https://stackoverflow.com/questions/6136783/output-line-by-line-with-php) , but from command line, you can test it by doing:

for i in `php t.php`; do echo "_M_${i}_M_"; done

and you will see al the lines surrounded by "M".

cyberpunkbln commented 1 year ago

@ifsnop thx, but can you short give an example how can i catch every output line? I mean when i disable server buffering and use $dump->start('php://output');??thx

ifsnop commented 1 year ago

Just a question, how do you know that you are not getting line by line output?

@ifsnop https://github.com/ifsnop thx, but can you short give an example how can i catch every output line? I mean when i disable server buffering and use $dump->start('php://output');??thx