PHP Fatal Errors

I’m still in my ‘What kind of things PHP can do?’ mode. Today’s topic was PHP fatal errors. Ideally what I want is that whenever a fatal error occurs I would log the error message and redirect / display a user friendly page. Coming off a Java project I foolishly thought that I could do the following:

try
{
   ... do your stuff
}

catch (Exception $ex)
{
   // $ex contains the fatal error's message
   // log the message
   // and redirect / display a more friendlier page
}

But apparently PHP’s exception handling mechanism can only catch… exceptions. And apparently errors != exceptions. So how does one handle fatal errors in PHP?

Or how about how difficult is it for PHP to catch fatal errors with exceptions?

My dear non existent readers please enlighten me.

PHPEclipse

I’m using PHPEclipse as my main IDE for The Project. What do I love most about PHPEclipse - and well Eclipse in general? I love the fact that every time I start it up in the morning it is considerate enough to give me time to not only grab a cup of coffee but to grind the beans and make the actual coffee as well.

Oh well… At least it doesn’t randomly freeze up on me like some other IDEs (<cough>NetBeans PHP</cough>).

I should really investigate using a good old fashioned text editor for The Project. TextMate looks good and apparently it now has a PHP code completion module!

An Introduction

I have been assigned to a new project at work today. I thought this would be a good time to start this blog. I’ve always wanted a place where I could showcase the sheer ridiculousness that I, as a software developer / programmer, have to go through at times to get my code to do what it’s supposed to do. Because ultimately that’s what I get paid for. Sure I could throw in best practices and maintainability. But that’s always after I get things to work.