execution - When will "while(1) { sleep(1); }" die in PHP? -
i wondering today whether or not script terminated when user exit webpage (while loading). turns out yes, unless set otherwise. so, in mind, when script finish?
// don't stop script when user closes window ignore_user_abort(); set_time_limit(0); // infinite loop (normally aborted when user closes window) while(1) { sleep(1); } my best bet is, when php and/or server turned off/on. however, in production system, can in critical situations. question is, when script ended? mean without action being taken end specific script. wouldn't same script without sleep() potential hazard hosting companies? set out 1 of them expensive operation , server 100% script.
here thinking of:
- apache restarted - hosting companies if reaches cpu usage limit.
- some hosting companies limit processes x number of processes @ same time (ex: 1and1). once 3 people access site, else error 500.
some hosting have ignore_user_abort/set_time_limit in disabled_functions list same reason.
update: changed many some. guess hosts use pretty different people use.
Comments
Post a Comment