[TYPO3-dev] Fail-safe mechanism for database connectivity problem

Dan Frost dan at 3ev.com
Fri Oct 6 12:56:44 CEST 2006


Dmitry Dulepov wrote:
> Hi!
> 
> Martin Kutschker wrote:
>> The next issue is that you need to deal with the fact that there are
>> possibly pages affected by user sessions (eg restricted areas) and of
>> course all the non-cached dynamic pages. I have no idea what to do
>> woth them except to present a "not-available" page in the site design.
> 
> I remember someone asked for custom error pages in typo3... Currently it
> is possible to customize 404. May be we should think about other custom
> pages for 4.1.
> 

We built a system recently using PHP5's exceptions and set_error_handler
so that you never see a database error or even a minor PHP error.

The first part is to catch all nasty PHP errors.

set_error_handler('evErrorHandle');

function evErrorHandle(...) {
  // do what you want with the error here
}

Then you wrap the entire index.php in:

try {
  // normal index.php
} catch (e) {
  // show a pretty fail-over page here
}

This is actually in a library which we will publish in the next few days
or so...

dan



-- 
Dan Frost
Technical Director
3rd Eye Vision - 3ev.com




More information about the TYPO3-dev mailing list