Note that there are some explanatory texts on larger screens.

plurals
  1. POob_start() and ob_flush() doesn't work
    primarykey
    data
    text
    <p>I am using <code>ob_start()</code>/<code>ob_flush()</code> to, hopefully, give me some progress during a long import operation.</p> <p>Here is a simple outline of what I'm doing:</p> <pre><code>&lt;?php ob_start (); echo "Connecting to download Inventory file.&lt;br&gt;"; $conn = ftp_connect($ftp_site) or die("Could not connect"); echo "Logging into site download Inventory file.&lt;br&gt;"; ftp_login($conn,$ftp_username,$ftp_password) or die("Bad login credentials for ". $ftp_site); echo "Changing directory on download Inventory file.&lt;br&gt;"; ftp_chdir($conn,"INV") or die("could not change directory to INV"); // connection, local, remote, type, resume $localname = "INV"."_".date("m")."_".date('d').".csv"; echo "Downloading Inventory file to:".$localname."&lt;br&gt;"; ob_flush(); flush(); sleep(5); if (ftp_get($conn,$localname,"INV.csv",FTP_ASCII)) { echo "New Inventory File Downloaded&lt;br&gt;"; $datapath = $localname; ftp_close($conn); } else { ftp_close($conn); die("There was a problem downloading the Inventory file."); } ob_flush(); flush(); sleep(5); $csvfile = fopen($datapath, "r"); // open csv file $x = 1; // skip the header line $line = fgetcsv($csvfile); $y = (feof($csvfile) ? 2 : 5); while ((!$debug) ? (!feof($csvfile)) : $x &lt;= $y) { $x++; $line = fgetcsv($csvfile); // do a lot of import stuff here with $line ob_flush(); flush(); sleep(1); } fclose($csvfile); // important: close the file ob_end_clean(); </code></pre> <p>However, nothing is being output to the screen at all.</p> <p>I know the data file is getting downloaded because I watch the directory where it is being placed.</p> <p>I also know that the import is happening, meaning that it is in the while loop, because I can monitor the DB and records are being inserted.</p> <p>Any ideas as to why I am not getting output to the screen?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload