Need to do a redirect after execution of the script. Ie index.php sends to another file after the form is submitted POST'ω, where processing the form, after which it would be nice to return to the original page. I understand that header('Location:' . __DIR__ . '/index.php');
but the problem is that index.php then does not display the changed information.
First, redirect need to specify the path on the website, not the server. header('Location: /index.php');
Second, if processing a few seconds, the handle should be in the same script, and then redirect to the result.
If the treatment is very long, it is necessary to write to the queue processing and display the "your request has been accepted and is being processed." A separate daemon or the cron processing of the queue and through the web socket to output the result to the client.