O2U
O2U

Reputation: 439

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

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!

Upvotes: 2

Views: 14012

Answers (3)

Venkat Kotra
Venkat Kotra

Reputation: 10753

Please try.

composer install

Sometimes it could be as simple as this.

Upvotes: 3

O2U
O2U

Reputation: 439

Thanks guys for your help. Turns out that I had mucked up my Apache installation so that it wasn't finding the intl extension. Once I got that installed again everything is well.

Upvotes: 0

Victor Bocharsky
Victor Bocharsky

Reputation: 12306

Try to add

$kernel = new AppKernel($env, $debug);
$kernel->loadClassCache();
$application = new Application($kernel);
$application->run($input);

Upvotes: 0

Related Questions