If I kill PHP, the process
Will the PHP process execute the __destruct () destructor?
What is the impact on the life cycle of PHP?
I think that Linux kill is out of the control of PHP, and the PHP life cycle has no relationship, is this understanding?
If so, who does the PHP process use to maintain the memory?
Another: If my demand is: Notify the end of the PHP process (such as PHP is currently a dead loop), so that PHP itself to complete the life cycle, how to deal with it?
Reply content:
If I kill PHP, the process
Will the PHP process execute the __destruct () destructor?
What is the impact on the life cycle of PHP?
I think that Linux kill is out of the control of PHP, and the PHP life cycle has no relationship, is this understanding?
If so, who does the PHP process use to maintain the memory?
Another: If my demand is: Notify the end of the PHP process (such as PHP is currently a dead loop), so that PHP itself to complete the life cycle, how to deal with it?
Similar to forcing the end of a process under Windows, you will be prompted to lose the data because the process does not knowingly end abruptly and does not handle the aftermath effectively.
The kill process is no longer in the scope of PHP management, which is a system level.
Therefore, the destructor will not execute, because the premise of execution is PHP active trigger, now PHP is gone.
Before kill, the memory is applied according to the configuration, and PHP maintains and recycles itself. The memory release after Kill is of course the Linux maintenance, even if the remaining zombie process, is also system management.
Notify PHP process end, you can try the signal, FPM comes with signal processing, restart, stop and so on.
Typically, PHP code does not normally capture the signal that the kill sends.
And I'm not sure PHP is capable of capturing it.
Another: If my demand is: Notify the end of the PHP process (such as PHP is currently a dead loop), so that PHP itself to complete the life cycle, how to deal with it?
Workaround
开始时间 = 当前时间生命周期时间 = 300while(ture){ if (当前时间 - 开始时间) >=300 退出 else 执行业务逻辑}
Do not meet the main demand ~ quiet to the Wise
Kill a process, the memory of the process is of course recycled by the operating system
If you have a demand for signal capture, see PHP's Pcntl extension