0

My Drupal 8 site is working fine but when I am clearing the cache then my site display below errors.

The website encountered an unexpected error. Please try again later.

Please suggest me what is the problem ? I have checked status report and it shows the error below

enter image description here

  • have you given the name of the controllers and file according to PSR that drupal 8 is using? – Shabir A. Dec 21 '15 at 13:09
  • It would help to see the controller class in "first_module". – mradcliffe Dec 21 '15 at 14:54
  • 2
    Let us see the first_module routing file and the controller or we cannot help you. You may not have declared the namespace in your controller class file. – cilefen Dec 21 '15 at 15:38
1

I was also getting the same error. The reason is given in the error message,i.e. Drupal is not able to find the specified controller. In my case, in the routing yml, the controller's path is "hello_world\Controller\HelloController", whereas my HelloController.php file was contained in the hello_world\src folder instead of the required path (**hello_world\src\Controller** folder).

My hello_world.routing.yml contents

hello_world.content:
 path: '/hello'
defaults:
 _controller: '\Drupal\hello_world\Controller\HelloController::content'
_title: 'Hello World'
requirements:
_permission: 'access content'
-1

this work for me:

  1. update script in settings.php i.e $settings['update_free_access'] = TRUE;
  2. and then run { website url}/update.php

Note: After running update.php set 'update_free_access' to FALSE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.