1
votes

I know there is similar question on stackoverflow but they are for previous version of symfony and I didn't find any solution to my problem.

I've just migrated from symfony 3.3 to symfony 4.0 and I can't manage to migrate customization of error pages.

I did what is explained on https://symfony.com/doc/current/controller/error_pages.html. So I put an error.html.twig file, an error404.html.twig file and an exception.html.twig file on templates\bundles\TwigBundle\Exception repository.

In my prod environment, it's working just fine when debug is true. It uses exception.html.twig template. But when debug is false, it didn't work and the default symfony template is displayed instead of mine.

I can't find any idea why? Do you?

2

2 Answers

4
votes

This is what worked for me:

1) Check ownership & permissions on your templates and template directories. From the templates directory, you could:

sudo chown -R www-data:www-data *

2) Then shut off debugging in your .env file by removing the APP_DEBUG line, or setting it to false:

APP_ENV=prod
APP_DEBUG=false

3) Finally, in the project root, clear the Symfony cache:

bin/console cache:clear
0
votes

Add APP_DEBUG=0 in your .env file

Note that APP_DEBUG=false didn't work for me in Symfony 4

See : https://symfony.com/doc/current/configuration/environments.html#index-3