This is an most common error we get, many times on the live sites suddenly we get this error and that time we are not able to access the error reposting and the drupal logs so in that case first we need to show the proper error which we have in the website.
The above is not an error its just an simple text appears on the drupal site but the actual errors are completly different so we need to enable the debug mode then we can track the actual error and fix that...
First Solution :
Step 1: Locate to the - sites/default/services.yml file and open in any editor
Step 2: Now find these in the file -
Step 3: Replace the above with these
If still the “ Website Encountered an Unexpected Error. Please try again Later “ appearing instead of the errors then just simply follow these steps.
Second Solution :
Locate to the – sites/default/settings.php and open it in any editor
Now add this line
$config['system.logging']['error_level'] = 'verbose';
When we add this line to settings.php file then all the errors will appears properly on the webpage instead of the “ Website Encountered an Unexpected Error. Please try again Later “
The error levels are defined in the bootstrap.inc as follows:
- const ERROR_REPORTING_HIDE = 'hide';
- const ERROR_REPORTING_DISPLAY_SOME = 'some';
- const ERROR_REPORTING_DISPLAY_ALL = 'all';
- const ERROR_REPORTING_DISPLAY_VERBOSE = 'verbose';
These will help you to show all the errors on the webpages.