I have a long running script after a user submits a form and I am trying to redirect them before the actual script starts executing
I tried to implement the accepted answer here How to cause a redirect to occur before php script finishes?
But I think the solution is outdated cause it does nothing
Here is the code at the top of the script once a form is submitted
set_time_limit(0);
header ( 'Connection: close' );
ob_start ();
header ( 'Content-Length: 0' );
header("Location: www.google.com");
ob_end_flush ();
flush ();
ignore_user_abort(true);
Expected Results: My Expected result is for the user to click the submit button and they are redirected to google.com meanwhile the script will continue to execute on my server
Actual Result: What is actually happening is the user just sits on the page till the script finishes execution