martedì 2 giugno 2015

Google Develop

A PHP script has a limited amount of time to generate and return a response to a request, typically around 60 seconds. Once the deadline has been reached, the TIMEOUT bit on the connection status bitfield is set. Your script will then have a short second deadline to clean up any long running tasks and return a response to the user.


function check_conn_timeout() {
  $status = connection_status();
  if (($status & CONNECTION_TIMEOUT) == CONNECTION_TIMEOUT) {
    echo 'Got timeout';
  }
}
while(1) { 
  check_conn_timeout();
  sleep(1);
}