Bonjour a tout(e)s,
J'ai un probleme avec les pages 404 de symfony. Dans le mode dev, le comportement est normal. Les pages qui n'existent pas me montrent le message d'erreur associe. Neanmoins, j'aimerais avoir une page d'erreur plus propre dans le mode prod, et je ne sais pas pourquoi mais ce n'est pas le cas. A la place, je recois le meme message d'erreur que dans le mode dev. D'ou peut venir le probleme?
Voici quelques fichiers pertinents
www/app.php
app/Resources/TwigBundle/views/Exception/error.html.twig
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 <?php use Symfony\Component\ClassLoader\ApcClassLoader; use Symfony\Component\HttpFoundation\Request; $loader = require_once __DIR__.'/../app/bootstrap.php.cache'; // Use APC for autoloading to improve performance. // Change 'sf2' to a unique prefix in order to prevent cache key conflicts // with other applications also using APC. /* $apcLoader = new ApcClassLoader('sf2', $loader); $loader->unregister(); $apcLoader->register(true); */ require_once __DIR__.'/../app/AppKernel.php'; //require_once __DIR__.'/../app/AppCache.php'; $kernel = new AppKernel('prod', false); $kernel->loadClassCache(); //$kernel = new AppCache($kernel); // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter //Request::enableHttpMethodParameterOverride(); $request = Request::createFromGlobals(); $response = $kernel->handle($request); $response->send(); $kernel->terminate($request, $response);
Et l'erreur que je recois dans le mode prod
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 {% if is_granted('ROLE_ADMIN') %} It does not work {% else %} {% extends '::base.html.twig' %} {% block body %} <h1>Oups! Une erreur est survenue</h1> <h2>Le serveur a retourner une erreur</h2> {% endblock %} {% endif %}
Merci pour votre aide, et bonne journee,Fatal error: Uncaught exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' with message 'La page bonjour n'existe pas' in /home/filautro/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php:149 Stack trace: #0 /home/filautro/src/Acme/PageBundle/Controller/PageController.php(16): Symfony\Bundle\FrameworkBundle\Controller\Controller->createNotFoundException('La pagebonjourn...') #1 [internal function]: Acme\PageBundle\Controller\PageController->indexAction('bonjour') #2 /home/filautro/app/bootstrap.php.cache(2929): call_user_func_array(Array, Array) #3 /home/filautro/app/bootstrap.php.cache(2901): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #4 /home/filautro/app/bootstrap.php.cache(3040): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #5 /home/filautro/app/bootstrap.php.cache(2307): Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->h in/home/filautro/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php on line 149
Frederic
Partager