In your frontend controller (web/app.php
in the Symfony Standard Edition), an instance of AppKernel
is created. AppKernel
inherits the constructor from Symfony's Kernel
, which requires two arguments:
/**
* Constructor.
*
* @param string $environment The environment
* @param bool $debug Whether to enable debugging or not
*/
public function __construct($environment, $debug)
The $environment
parameter only determines which configuration is used (config_dev.yml
, config_prod.yml
, etc.). The $debug
parameter is the one that enables or disables debugging (and therefore determines wether exceptions are shown or not).
So in app.php
, change:
$kernel = new AppKernel('prod', true);
to
$kernel = new AppKernel('prod', false);
This should replace the detailed exception pages with user-friendly error pages.