symfony自定义错误页面生产环境

I created custom error pages for symfony.

In development enviroment it works by using the following from the handbook:

http://localhost/app_dev.php/_error/{statusCode}

This is working.

But now in the production environment. I prepared the production environment with the following code:

php bin/console cache:clear --env=prod --no-debug

This is not working, I do not get my custom error page but the default one.

I found some articles on stackoverflow but not with the right solution.

If you use the standard edition, then /_error is mounted under routing_dev.yml. That's mean that it's available only on dev environment. You can move it from routing_dev.yml to routing.yml.

# app/config/routing.yml
_errors:
    resource: "@TwigBundle/Resources/config/routing/errors.xml"
    prefix:   /_error

I have the problem solved.

It was a permission problem on linux.

The file /var/www/project/var/logs/prod.log was the problem probably that the error pages could not be logged. Strange that the rest of the website was working.

Error pages are working now.