gpt4 book ai didi

php - 连接在 500 秒后被对端重置

转载 作者:搜寻专家 更新时间:2023-10-31 21:39:02 24 4
gpt4 key购买 nike

当我在 made 中运行 import cronjob 时,我遇到了这个奇怪的问题。它处理一个 1.5GB 的 XML 文件,其中包含大约 400.000 个产品。该脚本工作正常,需要几个小时才能完成,但在大约 500/600 秒后,我从 cron-deamon 收到以下电子邮件。

PHP Warning: file_get_contents(http://test.nl/admin/cron_index.php?route=module/EZImport&cron): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in /home/test.nl/public_html/admin/controller/tool/EZImport_cron.php on line 8

Warning: file_get_contents(http://test.nl/admin/cron_index.php?route=module/EZImport&cron): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in /home/test.nl/public_html/admin/controller/tool/EZImport_cron.php on line 8 bool(false)

我的 apache 错误日志说:

[Fri Nov 02 09:43:39 2012] [warn] [client 176.9..174] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server [Fri Nov 02 09:43:39 2012] [error] [client 176.9..174] Premature end of script headers: cron_index.php

这是cronjob调用的cron文件

    require_once('../../config.php');    $opts = array('http' =>        array('timeout' => 36000)    );    $context  = stream_context_create($opts);    $url = HTTP_SERVER."cron_index.php?route=module/cronMod&cron";    $result = file_get_contents($url, false, $context);    var_dump($result);    die();

我需要通过 file_get_contents 运行这个 cron

环境:

Derby 安,打开购物车

webmin(php 配置)中的最大执行时间设置为 36000 秒。

最佳答案

processes a 1.5GB XML file

呃,这有点傻——你需要至少 2 次通过才能验证文档格式是否正确,并且有很大的空间可以发生坏事。

The max execution time in webmin (php config) is set to 36000 seconds

为了什么目的?

您还需要为网络服务器以及客户端和服务器之间的链中的每个其他组件配置超时,但是尝试通过 HTTP 传输 1.5Gb 文件是愚蠢的——您可能会让它工作——但它不是解决问题的正确方法。将其分解为更易于管理的 block 。

关于php - 连接在 500 秒后被对端重置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13192363/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com