I have a script that runs from a cron job every night. Recently, it has started totally freezing up after several minutes into the script, and I can’t figure out why. If this was Java, I could simply run kill -3 PID and it would print a thread dump in stdout. Is there any equivalent in PHP, where I could get a dump of the current stack trace (and ideally memory info) on a running PHP script?
I have a script that runs from a cron job every night. Recently, it
Share
The best thing you can do is compile PHP yourself using
--enable-debugduringconfigure. If the process then still hangs you can use gdb and some macros to get a PHP-level stacktrace using these steps:And then debug ahead 🙂
Note that for this to work you have to have a PHP binary with symbol information,
--enable-debugensures that.