13

Since the update to symfony 2.2, the web debug toolbar is no longer loaded in app_dev.php.

I get the following error:

An error occurred while loading the web debug toolbar (404: Not Found).
Do you want to open the profiler?

In the prod.log I get the following:

request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /_profiler/84fb75cc3ffd5435474ebe4250e01fac2cdf49c1"" at /httpdocs/project/app/cache/prod/classes.php line 3597 [] []

request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /_wdt/452d5b4aa2dd9388285fa1c286d5c54218029c71"" at /httpdocs/priject/app/cache/prod/classes.php line 3597 [] []

I have cleared the cache several times :)

Interesting is the fact that in /app_dev.php all links on the page no longer links to /app_dev.php.

including the profile (/_profiler/5fdc27cb82c4e9e426b3ab27377deb0b760fdca2) when i modify the url manually, and add the app_dev.php to the url, the profiler loads correctly.

routing_dev.yml:

_assetic:
    resource: .
    type:     assetic

_wdt:
    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
    prefix:   /_wdt

_profiler:
    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
    prefix:   /_profiler

_configurator:
    resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
    prefix:   /_configurator

_main:
    resource: routing.yml

I would be grateful for any help.

UPDATE I: config_dev.yml

imports:
    - { resource: config.yml }

framework:
    router:   { resource: "%kernel.root_dir%/config/routing_dev.yml" }
    profiler: { only_exceptions: false }

web_profiler:
    toolbar: true
    intercept_redirects: false

monolog:
    handlers:
        main:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: debug
        firephp:
            type:  firephp
            level: info
        chromephp:
            type:  chromephp
            level: info

assetic:
    use_controller: true

UPDATE II: AppKernel.php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $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\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new JMS\AopBundle\JMSAopBundle(),
            new JMS\DiExtraBundle\JMSDiExtraBundle($this),
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
            new myProject\MyBundle\myBundle(),
            new FOS\UserBundle\FOSUserBundle(),
            new myProject\MyBackendBundle\myBackendBundle(),
       );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
}

Update III: .htaccess

DirectoryIndex app.php

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^app\.php(/(.*)|$) %{CONTEXT_PREFIX}/$2 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]

    RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]
    RewriteRule .? %{ENV:BASE}app.php [L]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        RedirectMatch 302 ^/$ /app.php/
    </IfModule>
</IfModule>

UPDATE: I have found the error, it was a wrong (old) render tag in a template. :(

Thanks for your support

Bol
  • 131
  • 1
  • 1
  • 4

8 Answers8

11

I had this problem too, try to pay attention to your .htaccess and make it look like this:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^app_dev.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]    ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]
    RewriteRule .? %{ENV:BASE}/app_dev.php [L]        ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        # When mod_rewrite is not available, we instruct a temporary redirect of
        # the startpage to the front controller explicitly so that the website
        # and the generated links can still be used.
        RedirectMatch 302 ^/$ /app.php/
        # RedirectTemp cannot be used instead
    </IfModule>
</IfModule>
5

In Symfony 4 + Flex i had to install symfony/apache-pack recipie

composer req apache-pack
3

I had this particular problem after installing my application on a fresh Linux box. I had just forgotten to activate mod_rewrite in Apache2

[sudo] a2enmod rewrite
[sudo] service apache2 restart

Hope it will help !

Moonchild
  • 1,382
  • 10
  • 15
1

Another source of this error: update the Apache web server without uncommenting the rewrite module. Learn by doing!

geoB
  • 4,578
  • 5
  • 37
  • 70
1

I came across this error when I modify vendor code for debugging purposes. (I do know it is not the right way but anyway.. I did modifications, tested the web application and forgot to roll back vendor code).

If it is Your case and You do not remember where exactly You did "illegal" changes to vendor code, You can remove vendor directory or its components and run php composer.phar update command to pull the original versions.

Oleksii Zymovets
  • 690
  • 8
  • 14
0

your rewrite rules is probably causing it. Just few moments ago I was rewriting mine and I had the same issue with the profiler.

Teffi
  • 2,498
  • 4
  • 21
  • 40
  • With an empty or older .htaccess File, the Problem still exists. – Bol Apr 27 '13 at 17:27
  • Maybe something is messed up anywhere in the core.If no one can provide solution yet. You probably should try having a new clean install of symfony 2.2 . Just move your bundles, reconfigure , create the schema. It won't take much of your time doing that rather than debugging that. – Teffi Apr 28 '13 at 06:25
0

To me this happen when I changed .htaccess (from web dir) in order to call app_dev.php instead of app.php, but I didn't change it everywhere in .htaccess file. After changing it's all appearances to app_dev.php error disappeared.

MilanG
  • 6,994
  • 2
  • 35
  • 64
-6

just do a restart to your WAMP/LAMP, it's working for me.