避免CGI超时
我有一个函数,它获取一个大的 XML 文件,然后解析它,然后使用详细信息来获取更多 xml 文件,然后再次解析它们(网上商店)。
问题是,处理大约需要 15-20 分钟,但脚本在此之前超时,并向我发送了 500 错误消息。
有办法解决这个问题吗?
我在这里读到一篇文章,经常写一条日志消息有助于避免这个问题,但我该怎么做呢?如果我尝试回显、写入或返回某些内容,它只会返回值并结束我的函数。
以下是错误消息:
[Wed Oct 13 10:34:41 2010] [warn] [client 213.175.111.200] Timeout waiting for output from CGI script /home/virtual/site14/fst/var/www/interpreters/php-script
[Wed Oct 13 10:34:41 2010] [error] [client 213.175.111.200] Premature end of script headers: php-script
[Wed Oct 13 10:36:41 2010] [warn] [client 213.175.111.200] Timeout waiting for output from CGI script /home/virtual/site14/fst/var/www/interpreters/php-script
谢谢!
I have a function, that gets a large XML file, then parses it, and then uses the details, to get some more xml files, that are again parsed ( A webshop).
The problem is, that the processing takes about 15-20mins, but the script timeout's before that, and sends me a 500 error message.
Is there a way around this?
I read on a post here, that writing a log message every so often helps avoid this problem, but how do I do that? If I try to echo, write or return something, it just returns the value and ends my function.
Here are the error messages:
[Wed Oct 13 10:34:41 2010] [warn] [client 213.175.111.200] Timeout waiting for output from CGI script /home/virtual/site14/fst/var/www/interpreters/php-script
[Wed Oct 13 10:34:41 2010] [error] [client 213.175.111.200] Premature end of script headers: php-script
[Wed Oct 13 10:36:41 2010] [warn] [client 213.175.111.200] Timeout waiting for output from CGI script /home/virtual/site14/fst/var/www/interpreters/php-script
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于那些寻找答案的人来说,您可以找到一些似乎有效的方法:
echo
函数将为您完成PS 我使用 javascript 重定向在某种程度上解决了我的问题,这是一个痛苦的问题,所以我不建议任何人以同样的方式这样做。
For those looking for an answer, there are a couple of things you could find, that seem to work:
echo
function will do it for youP.S. I somewhat got around my problem using javascript redirects, which were a pain in the a*s, so I do not recommend anyone doing it the same way.