Really Odd PHP/MySQL Problem

Status
Not open for further replies.

torok

Ars Tribunus Militum
2,000
Okay, I don't post here when I'm having a debugging problem, but this is just too weird. No debugging methods seem to work. Okay, here's the problem:

A while ago I reformatted my computer and forgot to dump the database structure of some software I was writing. So, now I went through all the code and built it back up as well as I could, but I am having one problem. On one of my scripts it just hangs in the browser and never outputs past a certain point. The cause of this is basicly indeterminable. I've commented out different sections of code to get it to work, but there is no pattern. No one line seems to be doing it, it's only by commenting out a few or more lines that makes it output and then stop. The other odd thing in that when it is just sitting there in the browser, halfway done, it doesn't time out in PHP (I think it's set to for a 30sec max. exec. time), and my CPU is running idle, so it doesn't appear to be stuck in a loop. And of course, I haven't changed the code and it worked fine before my reinstall.

Anyone have ANY clue to what's going on? I can post up code, but since I have no idea WHERE the problem is, it would be quite extensive. Thanks.
 

theFinn

Ars Tribunus Militum
2,705
Subscriptor++
If you hit 'stop' on your browser does the page (or at least part of it) come up?

I would suggest doing a couple things. Look around at some of the PHP debuggers available, or if thats not your 'thing' just start sticking in die("I'm here"); statements starting at the beginning and when it starts hanging and you're not seeing the 'I'm here' you know about where the problem lies.

- theFinn
 

_klamath_

Ars Scholae Palatinae
770
I don't know what support for debugging PHP has (presumably it's better than just "stick some printfs() in the code") -- I know with mod_perl, you can use the Perl debugger if you like, or choose from a couple other modules. If there is a debugger, use that, and examine the call stack to see where the code is getting stuck. If you can't figure out how to do this with PHP, you could try recompiling Apache with debugging symbols and connecting to Apache with gdb, then getting a stackdump that way. You could also try using 'strace' to see what system call is made last. It would simplify things to run Apache in single-daemon mode (httpd -X), so no children are forked.
 
Status
Not open for further replies.