Why is my Symfony2 install 404ing when I access app.php? Why is my Symfony2 install 404ing when I access app.php? symfony symfony

Why is my Symfony2 install 404ing when I access app.php?


A fresh symfony 2 install does not contain any routing for the production environment.If you take a look under app/config/routing_dev.yml, you will notice that all of the routes that you see in the demo application are defined only for development. If you wish to test the demo on app.php, you have to first copy the routing from routing_dev.yml to routing.yml, and also enable the AcmeDemoBundle under you AppKernel.php:

$bundles = array(        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),        new Symfony\Bundle\SecurityBundle\SecurityBundle(),        new Symfony\Bundle\TwigBundle\TwigBundle(),        new Symfony\Bundle\MonologBundle\MonologBundle(),        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),        new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),        new Symfony\Bundle\AsseticBundle\AsseticBundle(),        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),        new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),+       new Acme\DemoBundle\AcmeDemoBundle()    }if (in_array($this->getEnvironment(), array('dev', 'test'))) {-       $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();        $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();    } 

(+ is the line you should add, - is the line you should remove)


I had the same problem and I just cleared the cache. php app/console cache:clear --env=prod This has solved my problem.

Do not put the attribute to true: $ kernel = new AppKernel ('prod', TRUE); it will activate the debug mode and it is not recommended for the prod.


Had the same problem.

actually there might be several issues. but you must clear the cache with the console command as symfony caches routes, templates and config.