Apache将杀死一个PHP进程

Apache将杀死一个PHP进程

本文介绍了如果用户关闭连接,Apache将杀死一个PHP进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和我的一位同事有以下论点.我说过,如果用户关闭连接(例如,关闭窗口或选项卡),Apache将不会终止PHP进程.虽然我的同事说相反的话-如果TCP连接关闭,Apache将终止PHP进程.

I have the following argument with a colleague of mine. I stated that Apache won't kill a PHP process if the user closes the connection (closes the window or tab for example). While my colleague stated the opposite - that Apache will kill the PHP process if the TCP connection closes.

我们确实对其进行了测试,看起来好像是正确的,但是我不确定它是如何工作的.

We did tested it and it looked like I was right, but I am not sure about how this works.

推荐答案

首先,您说得对;-)

发生的事情是,您的浏览器选择忽略答案并继续前进.它不会使apache发出我退出,您可以停止"的提示.

What happens is, that your browser chooses to ignore the answer and move on. It does not send the apache some sort of 'I quit you can stop'.

该过程将一直运行到完成为止.因此,如果您编写了一个无限循环,那么关闭浏览器窗口将无法保存您.脚本的最大执行时间最终会确定,但这是另一个主题.

The process will run until it is finished.So if you code an endless loop, closing the browser window will not save you. The script max execution time eventually will, but that is another topic.

这篇关于如果用户关闭连接,Apache将杀死一个PHP进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 01:05