5 分钟后 php readfile_chunked 失败
这就是我现在所得到的:
$chunksize = 1024*4;
$h = fopen($file, 'rb');
set_time_limit(600);
while(!feof($h)){
echo fread($h, $chunksize);
flush();
}
fclose($h);
我尝试过增加块大小,我尝试过每次迭代重置超时,我尝试过将超时设置为零(最初是 5 分钟),我什至尝试过将flush()放在循环之外,让其自己的缓冲区处理它,每次下载都会在5分钟内终止。有时它是50.2MB,有时它是54.8或介于两者之间的任何东西,所以我知道这不是文件大小。 php_info() 说最大时间是 30 秒,所以我可以将其增加到 300,但仅此而已。
IIS(服务器2003)中是否有某些东西可以覆盖它?
This is what I've got at the moment:
$chunksize = 1024*4;
$h = fopen($file, 'rb');
set_time_limit(600);
while(!feof($h)){
echo fread($h, $chunksize);
flush();
}
fclose($h);
I've tried increasing the chunk size, I've tried resetting the timeout with every iteration, I've tried setting the timeout to zero (it was originally 5min), I even tried putting the flush() outside the loop to let its own buffer take care of it, and every single time the download dies at exactly 5 minutes in. Sometimes it's 50.2MB, sometimes it's 54.8 or anything in between, so I know it's not the file size. php_info() says the maximum time is 30seconds, so somehow I am able to increase it to 300 but that's it.
Is there something in IIS (server 2003) that could be overriding it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
啊,微软 MVP。每当他们说某件事是不可能的时,你就知道这只是挖掘的问题。
http://www.murraymoffatt.com/software-problem-0002.html
我能够为这个特定文件提供无限的运行时间,而不会影响网站的其余部分。
编辑:
看来这些文章开始消失了。
在 IIS 5.0 (Win2K) 中重置 FastCGI 超时:
管理工具 =>互联网服务经理)。
信息服务”位于最顶部,下面是名称
你的电脑。右键单击您的计算机名称并选择“属性”。
显示“WWW 服务”,然后单击“编辑”按钮。
以秒为单位指定。默认值为 300 秒(5 分钟)。
直接回到IIS管理控制台。关闭管理
安慰。
=>配件=>命令提示符)并键入命令:iisreset
IIS 5.1 (WinXP):
以下是 IIS 6.0 的说明: http://www.iisadmin.co.uk/?p= 7
但 MetaEdit 的下载链接已损坏,因此请在此处尝试:http://support.microsoft.com/kb/ 301386
Ah, Microsoft MVPs. Whenever they say something's impossible, you know it's just a matter of digging.
http://www.murraymoffatt.com/software-problem-0002.html
I was able to give this one specific file an unlimited run time without affecting the rest of the site.
EDIT:
Looks like those articles are starting to disappear.
Resetting FastCGI Timeout in IIS 5.0 (Win2K):
Administrative Tools => Internet Services Manager).
Information Services" at the very top, then below this the name of
your computer. Right-click your computer name and select "Properties".
"WWW Service" is showing, then click the "Edit" button.
specified in seconds. The default value is 300 seconds (5 minutes).
right back to the IIS management console. Close the management
console.
=> Accessories => Command Prompt) and type the command: iisreset
IIS 5.1 (WinXP):
Here's the instructions for IIS 6.0: http://www.iisadmin.co.uk/?p=7
but the download link for MetaEdit is broken, so try here: http://support.microsoft.com/kb/301386
我遇到了完全相同的问题..
对于任何人来说,这些解决方案是特定于 Windows IIS 的。
我刚刚花了 2 天尝试了每一种可能的配置,设置了 300 秒来尝试解决问题。
我更改了配置数据库中的 CGITimeout 值,但就我而言,罪魁祸首是 FastCGI ini 文件(位于
c:\windows\system32\inetsrv\fcgiext.ini
中)有一个设置 (以秒为单位):
更改此值并重新启动 IIS。
I was experiencing the EXACT same problem ..
For anyone looking, these solutions are specific to Windows IIS
I just went through 2 days of trying every possible config that had a setting of 300 seconds to try to fix the issue.
I changed the CGITimeout value in the metabase, but in my case the culprit turned out to be the FastCGI ini file (located in
c:\windows\system32\inetsrv\fcgiext.ini
)There's a setting (in seconds):
Change this value and restart IIS.