Symfony PHP Fatal error: Class 'Symfony\Component\HttpKernel\Kernel' not found

12,014

Please try.

composer install

Sometimes it could be as simple as this.

Share:
12,014
O2U
Author by

O2U

Updated on June 04, 2022

Comments

  • O2U
    O2U almost 2 years

    Hopefully someone else has run into this problem. Just downloaded a Symfony project and I'm getting the above error message : "PHP Fatal error: Class 'Symfony\Component\HttpKernel\Kernel' not found in /Applications/MAMP/htdocs/myapp/app/AppKernel.php on line 7

    I'm fairly new to setting up Symfony and here's what my app/autoload.php looks like:

    <?php
    
    use Doctrine\Common\Annotations\AnnotationRegistry;
    
    $loader = require __DIR__.'/../vendor/autoload.php';
    
    
    // intl
    if (!function_exists('intl_get_error_code')) {
        require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
    }
    
    AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
    
    return $loader;
    

    And here's what my app_dev.php file looks like:

    #!/usr/bin/env php
    <?php
    
    // if you don't want to setup permissions the proper way, just uncomment the following  PHP line
     // read http://symfony.com/doc/current/book/installation.html#configuration-and-setup   for more information
    umask(0000);
    
    set_time_limit(0);
    
    require_once __DIR__.'/bootstrap.php.cache';
    require_once __DIR__.'/AppKernel.php';
    
    use Symfony\Bundle\FrameworkBundle\Console\Application;
    use Symfony\Component\Console\Input\ArgvInput;
    
    $input = new ArgvInput();
    $env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
    $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
    
    $kernel = new AppKernel($env, $debug);
    $application = new Application($kernel);
    $application->run($input);
    

    If anyone could point me in the right direction that would be great thanks!

  • czerasz
    czerasz about 9 years
    On Debian this worked for me: printf "\n" | pecl install intl; echo -e "\nextension=intl.so" >> /usr/local/etc/php/php.ini