I'm having a problem with PHP Exceptions. Even if I try to execute this code:
try {
$some->knownMethodWithError();
} catch(Zend_Exception $exp){
echo 'Error!: ' . $exp-&g开发者_如何学Got;getMessage();
}
My apache/php served web page always display a 500 Error. I mean,
echo 'Error!: ' . $exp->getMessage();
never is executed. I've tested with a redirection instead of that echo, but it doesn't work. Is there some php.ini directive that cause this behavior, or could it be something else?.
This happens in my Zend Framework based project.
Also, your code will only catch Zend_Exception. If you have custom Exceptions maybe catch(Exception $e) will get more chances to catch all of them
maybe you could run the script with full logs. Change your php.ini
on the server on the line :
error_reporting=E_ALL | E_STRICT
or better run it on an IDE environment with a debugger.
A 500 error isn't a PHP exception, it's happening above the code level. A 500 error means that there was an error while PHP was trying to parse your script (probably). Possibly your code has a syntax error.
精彩评论