2

Before opening a ticket in the symfony repository, I just wanted to check if I have missed something obvious.

I want to enable the debug component (for having these nice exception screens, etc..).

I just installed symfony using

composer create-project symfony/framework-standard-edition symfony 2.3.1

For testing purposes I added an exception to the WelcomeController:

class WelcomeController extends Controller
{
    public function indexAction()
    {
        throw new \Exception("test");
        /*
         * The action's view can be rendered using render() method
         * or @Template annotation as demonstrated in DemoController.
         *
         */
        return $this->render('AcmeDemoBundle:Welcome:index.html.twig');
    }
}

Instead of showing me the (old) exception screen, I am just getting a 502 Bad Gateway from nginx.

app_dev.php:

//$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
$loader = require_once __DIR__.'/../app/autoload.php';
Debug::enable(-1);

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

$kernel = new AppKernel('dev', true);
//$kernel->loadClassCache();
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

Update:

Handling PHP errors does work however:

IDoNotExist();

produces the gray symfony error screen.

apfelbox
  • 2,625
  • 2
  • 24
  • 26
  • Why do you have `Debug::enable(-1);` and `Request::enableHttpMethodParameterOverride();` in **app_dev.php** ? – Dani Sancas Jul 03 '13 at 11:40
  • I did not change `Request:: enableHttpMethodParameterOverride()` it is in the stock `app_dev.php`. `Debug::enable(-1)` just to make sure that *all* error messages are logged. – apfelbox Jul 03 '13 at 12:06
  • Oh, I didn't know about `Debug::enable(-1);`, good point. And, about `Request:: enableHttpMethodParameterOverride()`, I haven't it in my **app_dev.php** (and I'm using SF2.3) – Dani Sancas Jul 03 '13 at 14:20
  • 1
    Did you remove it? https://github.com/symfony/symfony-standard/blob/v2.3.1/web/app_dev.php#L28 – apfelbox Jul 03 '13 at 21:53
  • Nevermind my comment, mate. I've opened my project to look for that line and to revise my git history and... there is, apparently had never gone, hahahahaha. Forgive me, I might looked wrong ;) – Dani Sancas Jul 04 '13 at 07:24

1 Answers1

2

Ok, the problem was an error in the nginx config.

The error log of nginx revealed the following:

2013/07/03 14:33:05 [error] 22792#0: *15 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /test/symfony_2.3.1/web/app_dev.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9111", host: "localhost"

I fixed it with adding

fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;

for the server {} in the nginx config (for reference http://forum.nginx.org/read.php?2,188352). This first occured with 2.3.0, 2.2.3 works without this fix.

Ticket related to this issue: https://github.com/symfony/symfony/issues/8413

apfelbox
  • 2,625
  • 2
  • 24
  • 26