Drupal - "The website encountered an unexpected error. Please try again later."
This error comes from an uncaught PHP exception. Drupal catches exceptions so no ugly PHP error message is displayed to user. You can find the exception info in the 'Recent log messages' link on Reports (or try this path: /admin/reports/dblog). Make sure 'Database logging' module is enabled because this module provides this report.
You will see all the internal messages that have been generated. Filter by type 'PHP' and Severity 'error' and you'll probably find a message about an uncaught exception. This is causing your problem. Now you have more information so you may be able to fix it.
EASY WAY for Drupal 8,
if you can't login anymore to access the recent log messages as described in the accepted answer.
Open the file /sites/default/settings.php
with an editor or ftp client and add this line:
$config['system.logging']['error_level'] = 'verbose';
After reloading the page you will see a full error message, instead of the generic “The website encountered an unexpected error. Please try again later.”
Drupal 6 & 7
If using Drush, just do drush vset error_level 1
.
Otherwise, go to "/admin/config/development/logging
" and change the setting to "Errors and Warnings"
Drupal 8
Instead of drush
vset
/vget
/vdel
, you can use cset
/cget
/cdel
for config values and sset
/sget
/sdel
for state values.