Return HTTP 200 response before continuing processing

  //--------------------------------------------
  //----- RETURN HTTP RESPONSE IMMEDIATELY -----
  //--------------------------------------------
  $OutputHtml = null;

  //$OutputHtml = //<<<Set content if you want to return content<<<<<<

  //Check if fastcgi_finish_request is callable
  if (is_callable('fastcgi_finish_request'))
  {
    if ($OutputHtml !== null)
      echo $OutputHtml;

    session_write_close();      //Close the session
    ignore_user_abort(True);    //Prevent echo, print, and flush from killing the script
    fastcgi_finish_request();   //This returns 200 to the user, and processing continue
  }
  else
  {
    ignore_user_abort(true);    //Prevent echo, print, and flush from killing the script
    ob_start();

    if ($OutputHtml !== null)
      echo $OutputHtml;
    
    header('Connection: close');
    header('Content-Length: '.ob_get_length());
    ob_end_flush();
    ob_flush();
    flush();
  }
  //CARRY ON HANDLING SCRIPT AS SLOWLY AS YOU WANT WITH RESPONSE ALRERADY SENT