du548397507 2014-09-01 05:09
浏览 542
已采纳

Laravel超时问题

I have a long running Laravel process to generate a report. When selecting long date ranges, I was getting a redirect back to the same URL after approximately 100s. I changed the code to this:

set_time_limit(20);
while(1) {
    $var = 3 + 4 / 11;
}

It runs for 20s then redirects to the same URL. I'd like to add that I have 2 routes, a GET route, and a POST route. The timeout happens for the POST route.

I've tried

set_time_limit(0);

but it didn't make a difference. I've turned on debug, but nothing. Any help is appreciated.

EDIT: I am running PHP 5.4.x so its not safe mode. EDIT: here is the controller - http://laravel.io/bin/WVdVz, Here is the last code that is supposed to execute - http://laravel.io/bin/aa2GW. EDIT: The error handling library, Whoops, catches and logs timeout errors. My logs are clean. This has something to do with how Laravel is treating responses after my _download function...

  • 写回答

1条回答 默认 最新

  • donglengyuan6826 2014-09-02 04:17
    关注

    After a lot of debugging, I figured it out. Apache was timing out. Apparently, when Apache times out, it throws a 500 response code. Apparently (again), when a browser gets a 500 error code to a POST request, it resends it as a GET request. I wrote it up here in more detail: http://blog.voltampmedia.com/2014/09/02/php-apache-timeouts-post-requests/

    To be clear, its not a Laravel issue. Do note that the Whoops library does capture the timeout error.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集