update page now
PHP 8.1.34 Released!

Voting

: max(two, five)?
(Example: nine)

The Note You're Voting On

Ilya Penyaev
13 years ago
I was quite stuck when trying to make my script redirect the client to another URL and then continue processing. The reason was php-fpm. All possible buffer flushes did not work, unless I called fastcgi_finish_request();

For example:

<?php
    // redirecting...
    ignore_user_abort(true);
    header("Location: ".$redirectUrl, true);
    header("Connection: close", true);
    header("Content-Length: 0", true);
    ob_end_flush();
    flush();
    fastcgi_finish_request(); // important when using php-fpm!
    
    sleep (5); // User won't feel this sleep because he'll already be away
    
    // do some work after user has been redirected
?>

<< Back to user notes page

To Top