Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 2.4: An error occurred while loading the web debug toolbar (404: Not Found)

I just downloaded a fresh copy of Symfony 2.4.1 on a Debian 7.3.

The URL /Symfony/web/config.php opens correctly, but when I proceed to Configure, I get:

The requested URL /Symfony/web/app_dev.php/_configurator/ was not found on this server.

If I Bypass configuration and open /Symfony/web/app_dev.php the page displays, but an error pops up saying:

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

If I accept, I get:

The requested URL /Symfony/web/app_dev.php/_profiler/54a8bf was not found on this server.

In other questions (e.g. Symfony 2: 404 Not Found Error when tryes to open /app_dev.php) people suggest to fiddle with the .htaccess file. I even tried removing it, but it had no effect.

The apache log file shows:

File does not exist: /var/www/Symfony/web/app_dev.php/_wdt/54a8bf, referer: http://wwwtest.di.unipi.it/Symfony/web/app_dev.php
File does not exist: /var/www/Symfony/web/app_dev.php/_profiler/54a8bf

So it looks like routing to any inner URL fails, despite the fact that the correct routing seems to be in place:

> app/console router:debug
[router] Current routes
 Name                      Method Scheme Host Path
 _wdt                      ANY    ANY    ANY  /_wdt/{token}
 _profiler_home            ANY    ANY    ANY  /_profiler/
 _configurator_home        ANY    ANY    ANY  /_configurator/
...
like image 594
user1746277 Avatar asked Jan 11 '14 05:01

user1746277


2 Answers

I have changed memory_limit in /etc/php5/fpm/php.ini to 512Mb and debug toolbar started to work.

Found solution for me here

like image 156
keltanas Avatar answered Nov 15 '22 04:11

keltanas


The solution for me was to update my app_dev.php file to resemble the one in the Symfony2 repo

Notice the Debug class being used. This wasn't used in older versions of symfony. I updated this file and the javascript alert appears to be gone.

<?php

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;

// 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);

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
/*
if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
*/
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
Debug::enable();

require_once __DIR__.'/../app/AppKernel.php';

$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
like image 29
Iterate Avatar answered Nov 15 '22 05:11

Iterate