Quantcast
Channel: Matthew Hughes » Matthew Hughes
Viewing all articles
Browse latest Browse all 18

Debugging PHP Programs By Email

$
0
0

Okay, so this is pretty evil.

Ever write any Node.JS? I’m quite partial to the Express framework. Perhaps what I love most about Node/Express is that it’s so easy to debug when things go wrong. It’s just a matter of logging stuff to the console.

PHP isn’t quite so easy to debug. I’ll quote Silverdrag from StackOverflow on this one:

In PHP, you have 3 categories of debugging solutions:

  • Output to a webpage (see dBug library for a nicer view of things).
  • Write to a log file
  • In session debugging with xDebug

Learn to use those instead of trying to make PHP behave like whatever other language you are used to.

All of these solutions work, but aren’t exactly what you’d call great. Which is why I’ve started debugging PHP via e-mail. It’s exactly what it sounds like.


if (x = y){
mail('me@matthewhughes.co.uk', 'x = y', x);
} else {
mail('me@matthewhughes.co.uk', 'x != y', x);
}

Yes, I know it’s crazy. Yes, I know it’s a little bit evil. Yes, I know it’s ugly as hell. But it works!  And it’s still not as insane as implementing an SSH server in PHP.

Do you have an unorthodox way of debugging your web applications? I’d love to hear about it. Drop me a comment below, will you?

The post Debugging PHP Programs By Email appeared first on Matthew Hughes.

flattr this!


Viewing all articles
Browse latest Browse all 18

Latest Images

Trending Articles





Latest Images