Symfony 2.4:加载Web调试工具栏时出错(404:Not Found)

时间:2014-01-11 05:07:19

标签: symfony configuration routing

我刚刚在Debian 7.3上下载了Symfony 2.4.1的新副本。

URL /Symfony/web/config.php正确打开,但当我继续配置时,我得到:

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

如果我绕过配置并打开/Symfony/web/app_dev.php 页面显示,但弹出错误说:

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

如果我接受,我会:

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

在其他问题(例如Symfony 2: 404 Not Found Error when tryes to open /app_dev.php)中,人们建议摆弄.htaccess文件。 我甚至尝试删除它,但它没有效果。

apache日志文件显示:

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

所以看起来路由到任何内部URL失败了,尽管事实上正确的路由似乎已经到位:

> 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/
...

4 个答案:

答案 0 :(得分:2)

我已将memory_limit中的/etc/php5/fpm/php.ini更改为512Mb,调试工具栏开始工作。

Found solution for me here

答案 1 :(得分:1)

我的解决方案是更新我的app_dev.php文件,使其类似于Symfony2 repo中的文件

注意正在使用的Debug类。这在symfony的旧版本中没有使用。我更新了这个文件,javascript警告似乎消失了。

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

答案 2 :(得分:0)

web / app_dev.php中是否有以下内容?下面的一行为我修好了。

$kernel->terminate($request, $response);

答案 3 :(得分:0)

Apache指令DirectoryIndex app.php为我做了一些技巧。 我把它放在带有AllowOverride None的apache vhost conf中,以防止被 .htacces 覆盖。

希望得到这个帮助。