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?


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.

|improve this answer|||||
  • 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

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

|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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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