Forums / Install & configuration / unexpected error and ErrorDocument 500 template

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() )
//[...]

eZ debug

Timing: Jan 18 2025 02:44:42
Script start
Timing: Jan 18 2025 02:44:42
Module start 'content'
Timing: Jan 18 2025 02:44:42
Module end 'content'
Timing: Jan 18 2025 02:44:42
Script end

Main resources:

Total runtime0.1940 sec
Peak memory usage4,096.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0142 589.3906180.8125
Module start 'content' 0.01420.0056 770.203198.1172
Module end 'content' 0.01980.1742 868.3203526.3594
Script end 0.1940  1,394.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00402.0805200.0002
Check MTime0.00140.7433200.0001
Mysql Total
Database connection0.00301.558410.0030
Mysqli_queries0.140072.15231410.0010
Looping result0.00140.71121390.0000
Template Total0.173789.510.1737
Template load0.00090.482410.0009
Template processing0.172889.031810.1728
Override
Cache load0.00070.344810.0007
Sytem overhead
Fetch class attribute can translate value0.00090.439610.0009
XML
Image XML parsing0.00020.113310.0002
General
dbfile0.00271.3672200.0001
String conversion0.00030.175230.0001
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs