PHP: how to stop ignore_user_abort, is it a good solution for long run program
let say i have send email program which need to run arround 7 hours. but i cant open the browser for 7 hours
beside cronjob,
ignore_user_abort() will it be a solution?
will the script stop 开发者_如何学运维when all email has sent and the program has finish the loop?
or it will keep eating the server memory?
some people said u may need to add some output at the end of the program to avoid the program run forever?
and some people also said echo a litte bit string will not stop the script, but has to use ob_flush, any example for this?
You don't want a single seven hour running PHP process on your machine. It will likely leak memory all over the place. Break the eMail-sending into chunks and send them asynchronously and/or have a look at http://gearman.org/
Also, ignore_user_abort
does only apply to PHP CLI.
After the loop, you script will exit whether ignore_user_abort
is set to true or not.
If you carefully design the script, you should not have any problems with memory leakage.
精彩评论