Sometimes due to programming error or due to very complex query
you can get your PHP script running too long, well after user
stopped waiting for the page to render and went browsing other
sites.
Looking at Server-Status I've seen scripts executing for hours
sometimes which is obviously the problem - they take Apache Slot,
MySQL Connection and other resources.
I had discussion today who was thinking Apache would kill the script after "Timeout" specified in Apache configuration is reached - this was not my experience so I decided to run couple of tests to check it.
I wrote couple of very simple scripts which demonstrate different behavior for scripts running very long time. For simplicity I did not use MySQL, but other system call - sleep() which has similar behavior for sake of experiment:
Script which simply runs in tight loop "forever"
PLAIN TEXT PHP:
- …