I've got a import function for one of my apps, and it worked great (with another host and my localhost), but on Webfaction it's not working.
Due to the executiontime of nearly 15 minutes, I want to quit the request, give the user a 'busy with importing' message and continue the script in the background. On my localhost (and on a place hosted somewhere else) it works fine. On Webfaction the page keeps loading (for about 10 minutes) and after that gives a server error: Error: 504 Gateway Timeout.
What can be the problem and how can I fix this?
header("Location: ".$url); // redirect the url to the 'busy importing' page
ob_end_clean(); //Erase the output buffer
header("Connection: close"); //Tell the browser that the connection's closed
ignore_user_abort(true); //Ignore the user's abort (which we caused with the redirect).
set_time_limit(0); //Extend time limit
ob_start(); //Start output buffering again
header("Content-Length: 0"); //Tell the browser we're serious... there's really nothing else to receive from this page.
ob_end_flush(); //Send the output buffer and turn output buffering off.
flush(); //Yes... flush again.
session_write_close(); //Close the session.
Sep 25 '12 at 13:09