use*_*277 6 configuration routing symfony
我刚刚在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.
Run Code Online (Sandbox Code Playgroud)
如果我绕过配置并打开页面显示/Symfony/web/app_dev.php,但会弹出一个错误说:
An error occurred while loading the web debug toolbar (404: Not Found)
Do you want to open the profiler?
Run Code Online (Sandbox Code Playgroud)
如果我接受,我得到:
The requested URL /Symfony/web/app_dev.php/_profiler/54a8bf was not found on this server.
Run Code Online (Sandbox Code Playgroud)
在其他问题中(例如,当试图打开/app_dev.php时,Symfony 2:404 Not Found Error)人们建议摆弄.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
Run Code Online (Sandbox Code Playgroud)
所以看起来路由到任何内部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/
...
Run Code Online (Sandbox Code Playgroud)
小智 1
我的解决方案是更新我的 app_dev.php 文件以类似于 Symfony2 存储库中的文件
请注意正在使用的 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);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8270 次 |
| 最近记录: |