Trong dự án Symfony2 của tôi, tôi đang ở chế độ phát triển chính xác Màn hình ngoại lệ 404. Nhưng tôi nhận được màn hình trống với mã trạng thái HTTP 500 thay vì 404 ở chế độ sản xuất. Tôi đang sử dụng các mẫu lỗi tùy chỉnh nằm trong app/Resources/TwigBundle/views/Exception
. Do lỗi apache log nó tạo ra thông điệp này: Lỗi Symfony2 500 thay vì 404 khi sản xuất
PHP Fatal error: Uncaught exception 'Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException' in /home/test/app/cache/prod/appprodUrlMatcher.php:518\nStack 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
Tôi đã gặp sự cố tương tự. Làm thế nào bạn giải quyết điều này? –