Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
756 views
in Technique[技术] by (71.8m points)

symfony - Symfony2 error 500 instead of 404 at production

In my Symfony2 project I'm getting at development mode correct 404 Exception screen. But I'm getting blank screen with HTTP status code 500 instead of 404 at production mode. I'm using custom error templates located in app/Resources/TwigBundle/views/Exception. In apache error log it creates this message:

PHP Fatal error:  Uncaught exception 'Symfony\Component\Routing\Exception\ResourceNotFoundException' in /home/test/app/cache/prod/appprodUrlMatcher.php:518
Stack trace:
#0 /home/test/app/cache/prod/classes.php(1025): appprodUrlMatcher->match('/404')
#1 /home/test/app/cache/prod/classes.php(4550): Symfony\Component\Routing\Router->match('/404')
#2 [internal function]: Symfony\Bundle\FrameworkBundle\EventListener\RouterListener->onKernelRequest(Object(Symfony\Component\HttpKernel\Event\GetResponseEvent))
#3 /home/test/app/cache/prod/classes.php(3777): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseEvent))
#4 /home/test/app/cache/prod/classes.php(3703): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'kernel.request', Object(Symfony\Component\HttpKernel\Event\GetResponseEvent))
#5 /home/test/app/cache/prod/classes.php(4787): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.request', Object(Symfony\Component\HttpKernel\Event\Get in /home/test/app/cache/prod/classes.php on line 4560
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

SymfonyComponentRoutingExceptionResourceNotFoundException means undefined route name. It looks like you've got somewhere in your error template {{ path('wrong_route') }}.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...