简体   繁体   中英

symfony error 500 instead 404 at production

my symfony project at production when an actions does not exist is throwing error 500 instead of 404. At dev enviroment, it shows error 404 (actually a debug of the 404 error says action not found).

I am using custom 404 templates as manual says.

It sounds like the error is in your custom 404 action. Can you provide the code for your 404 action and how you've defined your custom 404 in your settings.yml?

I was having the same issue where I was getting a 404 in debug, but a 500 in production. I know this isn't the answer for llazzaro's case since he marked Cyro as the correct answer, but here's what happened to me in case anyone else had a problem.

My actions class was not extending sfActions , but was instead extending an intermediate class (which in turn extended sfActions ). That intermediate class had a call to $this->getRoute() , which it was assuming returned an object, when in fact it can be null sometimes. Trying to access methods on a null object obviously failed, which caused the error 500.

I figured this out, (as Mike B suggested via comment on the original question), by checking my Apache logs. There was an error message there stating:

PHP Fatal error: Call to a member function getRequirements() on a non-object in /path/to/apps/my_app/lib/sfIntermediateActions.php on line 46

Hope this helps anyone else who can't solve it from the other answer offered here!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM