title: MAX EXECUTION TIME exceeded in long polling
body: <p>I am trying to get latest messages from the MySQL table using long-polling .</p>
  
  <p>Here if i haven't got any new messages i am making script <code>sleep()</code> for 10 seconds.</p>
  
  <p>But in the worst case scenario if i don't receive any new messages for <em>10 minutes</em> the script will say <code>max_execution_time</code> exceeded.</p>
  
  <p>How will i fix this . Can anyone say where i am going wrong.</p>
  
  <p><strong>PS</strong> - I don't want to use Websockets for now atleast.</p>
  
  <p><strong>pullmessage.php</strong></p>
  
  <pre><code>    $notyetgot = true;
      $data_msg = mysqli_query($con,"SELECT * FROM messages WHERE  message_id&gt;".$latest." ");
      $n  = mysqli_num_rows($data_msg);
      if($n &gt; 0){$notyetgot=false;}
      while($notyetgot){
          sleep(10);
  
          $data_msg = mysqli_query($con,"SELECT * FROM messages WHERE message_id&gt;".$latest." ");
  
          $n  = mysqli_num_rows($data_msg);       
          if($n &gt; 0){$notyetgot = false;}
  
      }
   ...
  </code></pre>