Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony3: Fatal error: Class 'AppKernel' not found in .\bin\console

Tags:

php

symfony

just started working on a project, I ran composer update and was greeted with a exception when trying to clear cache.

When I try to run php bin\console server:run I am greeted with this message:

php bin\console server:run
PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Fatal error: Class 'AppKernel' not found in CoreBundle\bin\console:27
Stack trace:
#0 {main}
  thrown in CoreBundle\bin\console on line 27

Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Fatal error: Class 'AppKernel' not found in CoreBundle\bin\console on line 27

Symfony\Component\Debug\Exception\FatalThrowableError: Fatal error: Class 'AppKernel' not found in CoreBundle\bin\console on line 27

Call Stack:
    0.0112     427536   1. Symfony\Component\Debug\ErrorHandler->handleException() CoreBundle\vendor\symfony\symfony\src\Symfony\Component\Debug\ErrorHandler.php:0
like image 623
Richard87 Avatar asked Dec 05 '22 18:12

Richard87


1 Answers

Another strong possibility, particularly if the project has been updated from a v2.7 project (or before) is that the AppKernel is just not known to Composer. It is now best practice to not manually require/include the file, (so those lines are removed from web/app_*.php, and bin/console.php). but instead have it autoloaded. However, this requires a line in Composer so that it can be found. Only the composer autoloader would ever be included manually, which can then load everything else.

"autoload": {
    "files": ["app/AppKernel.php"],
    "psr-4": {  // etc...
like image 192
Alister Bulman Avatar answered Dec 09 '22 02:12

Alister Bulman