6

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/
...
Community
  • 1
  • 1
user1746277
  • 71
  • 1
  • 4
  • 3
    Found the solution. One must add AcceptPathInfo On to the apache vhost configuration or to .htaccess. – user1746277 Jan 11 '14 at 05:57
  • Please fix the typo in the title. ;) – A.L Jan 11 '14 at 13:31
  • 7
    If you found the solution can you answer your own question so that others may more easily benefit from the answer when looking. – Chase Mar 31 '14 at 19:11
  • Resolved, Check my answer here: http://stackoverflow.com/a/30313196/1700429 – Dahab May 18 '15 at 21:38
  • Anyone who is using nginx, this worked for me: in /etc/nginx/conf.d/default.conf replace try_files $uri $uri/ /index.php?$args; by try_files $uri $uri/ /project-name/web/app_dev.php?$args; I myself have my symfony project in ~/Projects/project-name and a symlink in /usr/share/nginx/html/project-name pointing to my physical project. – eddy147 Feb 13 '16 at 09:22

4 Answers4

2

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

Found solution for me here

Alaeddine
  • 6,104
  • 3
  • 28
  • 45
keltanas
  • 21
  • 3
1

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);
Iterate
  • 51
  • 1
0

Is the following present in web/app_dev.php? The line below fixed it for me.

$kernel->terminate($request, $response);
Youri Thielen
  • 440
  • 4
  • 10
0

Apache directive DirectoryIndex app.php does the tricks for me. I put it in apache vhost conf with AllowOverride None to prevent override by .htacces.

Hope this help.

Jean-Luc Barat
  • 1,147
  • 10
  • 18