Prevent timeout during large request in PHP Prevent timeout during large request in PHP php php

Prevent timeout during large request in PHP


Try the set_time_limit() function. Calling set_time_limit(0) will remove any time limits for execution of the script.


Also use ignore_user_abort() to bypass browser abort. The script will keep running even if you close the browser (use with caution).


Try sending a 'Status: 102 Processing' every now and then to prevent the browser from timing out (your best bet is about 15 to 30 seconds in between). After the request has been processed you may send the final response.

The browser shouldn't time out any more this way.