doushi6947 2010-07-13 20:07
浏览 312

PHP:无法使ignore_user_abort(TRUE)正常工作

I have a script that has ignore_user_abort(TRUE); at the top and I call it like this

$socket = curl_init("http://...");
curl_setopt($socket, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($socket, CURLOPT_TIMEOUT_MS, 1000);
$result = curl_exec ($socket);
curl_close($socket);

This script does some boring work that I want to run in the background and judging from the result the script starts to do that work but shortly after that it stops. I've tried everything I know and I am really stuck now. May be there is some server config that can be blocking ignore_user_abort()? Please let me know if you have any ideas about this.

PS. set_time_limit() is set to a high value and cpanel is catching all errors into the error log so it is not dying of a fatal error.

  • 写回答

2条回答 默认 最新

  • dongzhun6952 2010-07-14 00:04
    关注
    curl_setopt($socket, CURLOPT_TIMEOUT_MS, 1000);
    

    here you define the maximum number of milliseconds to allow cURL functions to execute as 1000...so you are allowing your curl function to run only for one second....maybe this is it

    http://php.net/manual/en/function.curl-setopt.php

    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置