Prevent timeout during large request in PHP

后端 未结 3 646
孤独总比滥情好
孤独总比滥情好 2021-01-03 22:52

I\'m making a large request to the brightcove servers to make a batch change of metadata in my videos. It seems like it only made it through 1000 iterations and then stopped

相关标签:
3条回答
  • 2021-01-03 23:08

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

    0 讨论(0)
  • 2021-01-03 23:09

    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.

    0 讨论(0)
  • 2021-01-03 23:10

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

    0 讨论(0)
提交回复
热议问题