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

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

When I try to run php bin\console server:run , this message greets me:

 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 
+3
source share
2 answers

Another strong feature, especially if the project has been updated from project v2.7 (or earlier), is that AppKernel is simply not known to Composer. Currently, it is best not to require / include the file manually (therefore, these lines are removed from web/app_*.php and bin/console.php ). but instead, it automatically loads. However, this requires a string in Composer so that it can be found. Only the composerโ€™s autoloader will ever be turned on manually, which can then download everything else.

 "autoload": { "files": ["app/AppKernel.php"], "psr-4": { // etc... 
+10
source

There are two possible reasons for this.

At first, your autoloader is overloaded or cannot find files

 composer dump-autoload 

The second reason may be that your var directory is not writable, which puts the cache file for symfony. Just check permissions. Also carefully review the log files. Maybe he tells you what the real problem is. (For example, a problem with syntax, etc.)

+1
source

All Articles