What can I send back to the browser while I wait for PHP execution?
<p>So....I have a PHP page that involves a lot of backend execution, namely 'exec' calls to run shell commands on the host server.</p>

<p>This can take upwards of a few minutes depending on the calls involved. (If you look below, each recursion through the exec calls is mounting a LUN; I'd like to sometimes do upwards of 100 per execution.) I'm curious on what I can do to send content back to the browser (and prevent it from timing out).</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;sfvmtk&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;?php
      // TEMPORARY VARIABLES FOR TESTING
      $hba = 'vmhba38';
      $svip = '10.10.20.100';
      $targets = array ( 0 =&gt; array ( 'iqn' =&gt; 'iqn.2010-01.com.sf:t5np.esxtest.41',
                                      'account' =&gt; 'esx',
                                      'isecret' =&gt; 'isecret00000',
                                      'tsecret' =&gt; 'tsecret00000'
                                    ),
                         1 =&gt; array ( 'iqn' =&gt; 'iqn.2010-01.com.sf:t5np.esxtest2.42',
                                      'account' =&gt; 'esx2',
                                      'isecret' =&gt; 'isecret00001',
                                      'tsecret' =&gt; 'tsecret00001'
                                    )
                       );

      $hostname = $_REQUEST['hostname'];
      $username = $_REQUEST['username'];
      $password = $_REQUEST['password'];

      foreach ($targets as $ctarget) {
        exec('esxcli -s '.$hostname.' -u '.$username.' -p '.$password.' iscsi adapter discovery statictarget add -A '.$hba.' -a '.$svip.' -n '.$ctarget['iqn'], $out);
        exec('esxcli -s '.$hostname.' -u '.$username.' -p '.$password.' iscsi adapter target portal auth chap set -A '.$hba.' -a '.$svip.' -N '.$ctarget['account'].' -d uni -l required -n '.$ctarget['iqn'].' -S '.$ctarget['isecret'], $out);
        exec('esxcli -s '.$hostname.' -u '.$username.' -p '.$password.' iscsi adapter target portal auth chap set -A '.$hba.' -a '.$svip.' -N '.$ctarget['account'].' -d mutual -l required -n '.$ctarget['iqn'].' -S '.$ctarget['tsecret'], $out);
      }
      exec('vicfg-rescan --server '.$hostname.' --username '.$username.' --password '.$password.' '.$hba, $out);
    ?&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>
