finding out what is causing dreaded "The website encountered an unexpected error. Please try again later." message

brian_d picture brian_d · Jan 19, 2011 · Viewed 27k times · Source


while doing a drupal 6 to 7 upgrade I am getting the not so helpful message "The website encountered an unexpected error. Please try again later." everytime I go to certain pages. ex) /admin/config

What is the best way to find out what is causing the fatal error so that I can fix it?

All I can think of right now is to start disabling contributed modules until that page works or looking through the logs.

Thanks.

Answer

Stefano Caravana picture Stefano Caravana · Oct 1, 2013

If dlog/watchdog and php error log aren't working, try this:

go on /includes/error.inc comment line line 245

print theme('maintenance_page', array('content' => t('The website encountered an unexpected error. Please try again later.')));

and put this

print theme('maintenance_page', array('content' => t('The website encountered an unexpected error. Please try again later.'.$fatal.' '.var_export($error,true))));

Very similar, you put var_export($error,true)) at end of error