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

6

12


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.

Lactose answered 19/1, 2011 at 16:20 Comment(0)
L
11

By clearing the logs at /admin/reports/dblog then reloading the broken page I easily could identify the offending module when I rechecked the log.

Site is working fine now : )

Lactose answered 20/1, 2011 at 4:52 Comment(2)
The only problem with this solution is that when the problem is watchdog, itself, this doesn't work... as I am finding out.Ogilvy
If you're not logged in you cannot view /admin/reports/dblog, if you log in, you get the errorAirborne
C
21

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

Chelonian answered 1/10, 2013 at 9:50 Comment(0)
L
11

By clearing the logs at /admin/reports/dblog then reloading the broken page I easily could identify the offending module when I rechecked the log.

Site is working fine now : )

Lactose answered 20/1, 2011 at 4:52 Comment(2)
The only problem with this solution is that when the problem is watchdog, itself, this doesn't work... as I am finding out.Ogilvy
If you're not logged in you cannot view /admin/reports/dblog, if you log in, you get the errorAirborne
A
3

You definitely should be disabling all contrib modules to perform the upgrade. Then enable them a few at a time after they have been replaced with the D7 version. When replacing the module, be sure to clean out the entire module directory, just in case some old files remain.

This should help narrow down the problem and be sure to check the php error log in case you find something there. (Although that is usually in the case of the White Screen Of Death.)

Acetylene answered 19/1, 2011 at 18:38 Comment(0)
M
0

As gyozo mentioned if you are not able to log into the site, then it might be difficult to debug.

Then probably you could try

  1. Log into database and run delete from watchdog;
  2. Refresh the page
  3. Then execute the database query select variables from watchdog;
  4. Look out for the text near message
Motch answered 4/9, 2013 at 12:19 Comment(0)
T
0

Am replying on 8 years old thread. But wanted to share my inputs to fix this error. I am using Drupal 8.*

I faced the same error when I tried to clear the cache (From performance). I tried several things mentioned in most of the blogs or drupal help.

In the end I came to know that, there was some YML formatting issue in my Drupal 8 theme files. I removed tabs and validated my YML files from online YML validator.

Thruster answered 31/1, 2019 at 19:22 Comment(0)
C
0

In Drupal 8.7 you can do this in core/lib/Drupal/Core/EventSubscriber/FinalExceptionSubscriber.php line 126:

$content = $this->t('The website encountered an  error. Please try again later.' . var_dump($error));
Correctitude answered 28/5, 2019 at 2:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.