Reputation: 2005
As a relative newbie in the world of Linux debugging via gdb, etc. I'm looking for help with an issue we're seeing.
On a hosted/managed "VPS" (virtual private server - we're mostly, but not entirely, in control of the configuration) we observe that occasional PHP processes stick around "forever". Most web hits come and go normally, but these ones will last for tens of minutes if we don't identify and kill them ourselves.
I'd like to gdb attach to the processes and get a stack trace, but I'm not sure how. I'm also not sure if we need to be running PHP with debugging enabled.
Is there an easier way (maybe in the PHP code itself) to identify long-running PHP processes? Might help us if it's something simple like getting stuck in an infinite polling loop.
Upvotes: 1
Views: 1524
Reputation: 360572
PHP has an auto-kill feature that prevents scripts from executing past a certain time limit, look into the max_execution_time .ini setting, and the set_time_limit() function.
You should still figure out what's causing the script to not die, but this'll save you trouble of having to kill them manually.
Upvotes: 2