That's a browser time-out issue. If you really need to do something like that, you might want to do some sort of loop that outputs something on each iteration between shorter sleep() periods. But without understanding the underlying requirements, I won't even claim sleep() is the best way to do it: maybe it should be JavaScript doing a delay and then making an AJAX request to a PHP script?