【问题标题】:Laravel 5 Operation timed outLaravel 5 操作超时
【发布时间】:2016-05-24 10:50:06
【问题描述】:

laravel 5 在 hostgator 专用服务器上 30 秒后给我“操作超时”。

但我将最大时间更改为 3600 秒,并且它在我的本地主机上正常工作

我的代码是

$total = '';
for ($i=0;$i<60;$i++){
    $total .=  $i;
    sleep(1);
}
echo $total;

链接http://oemsys.net/test2


不,我使用专用服务器 所以我想我必须只添加我的代码

safe mode = off
memory_limit = 256M  
max_execution_time = 3600  
max_input_time = 60  
post_max_size = 64M  
upload_max_filesize = 64M  
enable_dl = on

【问题讨论】:

  • 对我来说运行没有问题,你可以在你的服务器上查看max_execution_time

标签: php laravel for-loop dedicated-server


【解决方案1】:

因为它循环 60 次需要 60 秒,

您是共享主机 hostgator 吗?如果是,则当前 hostgator 有一些无法更改的 PHP 设置..

safe mode = Off (cannot adjust)
memory_limit = 256M (MAXIMUM)
max_execution_time = 30 (MAXIMUM in seconds)
max_input_time = 60 (MAXIMUM in seconds)
post_max_size = 64M (MAXIMUM)
upload_max_filesize = 64M (MAXIMUM)
enable_dl = Off (cannot adjust)

来源:http://support.hostgator.com/articles/pre-sales-policies/php-settings-that-cannot-be-changed

我的建议为什么要使用睡眠?或尝试升级到 VPS 或其他共享主机可以编辑您的 PHP.ini

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-30
    • 1970-01-01
    • 2016-11-08
    • 2013-07-14
    • 2015-05-26
    • 2014-02-05
    • 2015-12-13
    相关资源
    最近更新 更多