PHP profiling delay before shutdown function

后端 未结 3 587
感动是毒
感动是毒 2021-01-19 05:05
// VERY BEGIN OF SCRIPT
$_SERVER[\'HX_startTime\'] = microtime(true);

...

// MY SHUTDOWN FUNCTION
register_shutdown_function(\'HX_shutdownFn\');
function HX_shutdo         


        
3条回答
  •  爱一瞬间的悲伤
    2021-01-19 05:20

    I'm assuming there's more code to this than you posted - in that case if you're transferring any output to the client, the script won't shutdown until it's been sent.

    There may also be additional shutdown functions registered which you might be unaware of as mentioned by the comments.

    If all else fails, try isolating this script (so ONLY the lines you posted, even without whatever substitutes the ...) and compare running it from command line and your web server. There might be some server-specific overhead involved.

提交回复
热议问题