unexpected error and ErrorDocument 500 template

Author Message

Jean-Raphael Frydman

Thursday 21 October 2010 3:06:01 am

Hello,

I'm trying to use a template for the error 500. The problem is when the mySQL server is stopped, eZpublish show the error 500 page : "An unexpected error has occurred. Please contact the webmaster." even if I specify a template for the error 500 like the 404.tpl

I've tried to use the ErrorDocument 500 in the .htaccess file (which is allowed in the virtual host) but it doesn't work.

If you have any idea...

sincerely,
Jean-Raphael

André R.

Thursday 21 October 2010 4:47:39 am

That error is using and exception and not template, so you can't override the view of those I'm afraid.

Do you often have to turn of your sql server for some reason?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Jean-Raphael Frydman

Thursday 21 October 2010 5:16:56 am

Hello André,

In case the SQL server crashes, it would be better to have a userfriendly page than the error message on a blank page.
Is there any way to catch the exception and to send another page ?

thanks

JR

André R.

Thursday 21 October 2010 7:49:03 am

you can try by using ouput filter, but don't think the exception is currently catched so think you'll need to hack index.php and do that your self if you need it.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Jean-Raphael Frydman

Monday 25 October 2010 3:28:21 am

Well, it almost works.

I have put this code in lib/ezutils/classes/ezexecution.php from line 195, in the defaultExceptionHandler function

what do you think ?
I still have some problems with the include of img in the html source, maybe a rewrite rule in the apache vhost config file.

static public function defaultExceptionHandler( Exception $e )    
{        if( PHP_SAPI != 'cli' )        
         {
            header( 'HTTP/1.x 500 Internal Server Error' );
            header( 'Content-Type: text/html' );
///////////            
          if ( $documentRoot )
            {                
             self::$eZDocumentRoot = $documentRoot;            }
             else if ( self::$eZDocumentRoot === null )
            {
             self::$eZDocumentRoot = getcwd();            }
            
            chdir( self::$eZDocumentRoot );

            $stringerror = file_get_contents('./errorpages/erreur_500.html', true);
            $splitString = str_split($stringerror, 8192);
            foreach($splitString as $chunk)
                echo $chunk;

///////////
           if( eZDebug::isDebugEnabled() )
//[...]

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 05:20:01
Script start
Timing: Jan 18 2025 05:20:01
Module start 'layout'
Timing: Jan 18 2025 05:20:01
Module start 'content'
Timing: Jan 18 2025 05:20:03
Module end 'content'
Timing: Jan 18 2025 05:20:03
Script end

Main resources:

Total runtime1.6121 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0093 588.1641152.6563
Module start 'layout' 0.00930.0038 740.820339.5156
Module start 'content' 0.01311.5972 780.3359561.9063
Module end 'content' 1.61030.0017 1,342.242216.1094
Script end 1.6120  1,358.3516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.2409160.0002
Check MTime0.00140.0852160.0001
Mysql Total
Database connection0.00060.036410.0006
Mysqli_queries1.550396.1722630.0246
Looping result0.00050.0317610.0000
Template Total1.549896.120.7749
Template load0.00190.120620.0010
Template processing1.547896.015020.7739
Template load and register function0.00020.010310.0002
states
state_id_array0.00200.124610.0020
state_identifier_array0.00340.212320.0017
Override
Cache load0.00170.1035280.0001
Sytem overhead
Fetch class attribute can translate value0.00060.037820.0003
Fetch class attribute name0.00120.072260.0002
XML
Image XML parsing0.00080.049320.0004
class_abstraction
Instantiating content class attribute0.00000.001170.0000
General
dbfile0.00100.0641170.0001
String conversion0.00000.000540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs