I have to do a lot of processing in the server end, but don't want user to aware of it. I want to send user a response immediately and then run the process in the server end.
I've done some study, and so far I've done this:
function process(){
    ignore_user_abort(true);
    set_time_limit(0);
    ob_start();
    // Send response to the user
    header('Connection: close');
    header('Content-Length: '.ob_get_length());
    ob_end_flush();
    ob_flush();
    flush();
    // Post process
}
As far as I'm aware of, this should return the user response immediately and then run the post processes. But it's not working: it still waits until all the processes are done.
Bytheway, I'm sending an AJAX request if it helps. At first I thought it might be a problem with session locking, but now I'm not even using any session (session_status() returns 1).
PHP version is 7.1
NOTE: I've read other related questions where the above method works fine, but for some reason it's not working in my case.