Question

I run a very long in terms of execution time php code, I normally run it with mozzila, and do othr stuff and work with chrome meanwhile.

I wonder what happens to the running code and how when i close the browser or it crashes, since all code should already be executing on the server anyhow.

Was it helpful?

Solution

By default the PHP process gets torn down the next time it tries to send output to the client¹, although you can change this behavior by using ignore_user_abort. For additional related information, read the manual section on connection handling.

¹ Note that in the presence of output buffering by PHP or by the web server, "echoing something" does not necessarily equal "output is sent to the client"; see flush.

OTHER TIPS

It depends alot on the set up of the server. If your running with gzip for example and close your browser, it can still excecute,

Ideally the httpd which called php should send the signal to stop, But it doesnt always happen

PHP itself can then control what it does providing it gets the signal by using ignore_user_abort

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top