duanjiao6730 2016-10-24 04:45
浏览 29
已采纳

apache日志每次都有大约25 GB的错误和警告

Here is my code to fetch data from websites which have there some data stores in txt files, I just give the urls and it starts fetching the data

foreach ($collector_urls as $key => $value) {
    $k=0;
    try{
        $file=fopen($value,"r");
        while (!feof($file)) {
            $str=fgets($file);
            $new_str=explode(".",$str);
            if(is_numeric($new_str[0])){
                // if (!in_array($str,$ip_array))
                $array[$ip_count++]=$str;

            }
        }

        $log[$name_in_key]=json_encode(array('status'=>'success','count'=>$k,'key'=>$name_in_key,'url'=>$value));
    }catch(Exception $e){
        print("Something wrong with file ".$value."<br>");
        $log->$name_in_key=array('status'=>'failed','count'=>0);
    }
} 

while the code does so , some warnings arrive such has invalid resource content for fopen, fgets and isnumeric

data is very very huge so I might consider about 300000 rows of error each time it executes , what is actually my problem is it fills almost 25 gb of meemory when executed inside apache log with errors and warnings

is there a way I can tell apche not to log warnings and errors inside log file or some other method also should I need to change some part of code which I am doing wrong

Need suggestions , thanks in advance

  • 写回答

1条回答 默认 最新

  • doucan9079 2016-10-24 06:21
    关注

    You can disable apache error log file by editing you vhost config file for the given domain by entering this line:

    ErrorLog /dev/null
    

    But I`ll advise you to fix the warnings and errors instead of disabling error log.

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

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料