Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm testing a version of my theme in WordPress 3.0 and it crashes Apache each time I try to preview it.

Where can I look to trace the cause of the crash? WP_DEBUG is of no use in this case, since it never gets to that point.

Can I trace errors in XAMPPLITE somewhere?

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

Survey said! Wolf Fence in Alaska.

The basic idea is that you divide your problem space in half by inserting a print "Hi, Mom!\n"; exit; (insert your favorite phrase) somewhere near the "middle" of your code. If you get the message, then the bug is beyond where you put the print, so move it farther along in the execution. If you don't get there, move the print earlier.

Lather, rinse, repeat.

If you Choose Wisely about where to put the print you can narrow a 1,000,000 line program down to 1 line in just 20 tries.

This is faster/easier to do from the command line, but it's possible to do it via FTP.

share|improve this answer
1  
+1 for dividing the code –  kaiser Feb 8 '11 at 16:50
    
Sweet. Working on it now. Great idea. My code, and my stress level has been divided in half :) –  Scott B Feb 8 '11 at 18:14
    
Never heard that expression, but have used a similar process many times myself.. +1 .. :) –  t31os Feb 10 '11 at 14:25
    
I first learned this technique from Rainer Schultz in 1975. We were debugging an evil assembly language program that had been written by a crazed hardware person several years before. I had tried by myself to figure it out for most of a week when I finally begged Rainer to help me. He shrugged and said, "Wolf Fence in Alaska should nail it." It took about 30 minutes. The only time this doesn't work is with asynchronous event debugging. In that case I recommend booze, drugs, or a remote monastery. :-) –  Peter Rowell Feb 12 '11 at 2:22
add comment

You can try looking in \xampplite\apache\logs for various error log messages.

share|improve this answer
    
Actually, I like this approach, too, and it would be my first choice if possible (which it should be if you're running xampplite). Unfortunately, some PHP errors don't make it into the logs, and then there are the many shared hosting situations where you don't have access to the error logs. –  Peter Rowell Feb 8 '11 at 23:39
    
As far as shared hosting goes, I believe PHP generates "error_log" files (no extension) containing a list of errors that happened recently. –  Zack Feb 9 '11 at 0:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.