PHP is meant to die. It doesn’t mean that it will disappear into nothingness, it just means that your PHP code can’t run forever; The core PHP feature follows the most simple programming workflow: get input data, process it, display the output, and die.
If you want to keep [PHP] processes running forever they will crash, and will do it really fast under load, because of known or unknown reasons. That’s nothing you can really control, it’s because PHP is meant to die. The basic implementation, the core feature of the language, is to be suicidal, no matter what.
Really interesting read (with follow-up) for anyone doing PHP development involving continously running PHP scripts. Highly recommended.
Been running a WebSocket Server — implemented via the excellent Ratchet which is built on top of the aforementioned React — for a few days now and with each connection that connects & closes a tad of memory is left occupied indeed (viz. opening and closing a connection doesn’t result in the same memory usage as before the connection was created) … looks like I’ll have to keep an eye on this.