Hi,
Is there a way to handle PHP Fatal errors and Parse Errors??? As if there is a syntax error, i want to catch the error and display the user defined message instead of php error but i could not caught that error. Please hep me in how to handle those.Error handler works fine with warnings and notice but not the Fatal errors and Parse Errors. Please hep me out of this
Handle PHP Fatal errors and Parse Errors
Moderator: General Moderators
-
balaji4php
- Forum Newbie
- Posts: 2
- Joined: Sun Dec 07, 2008 2:22 am
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Handle PHP Fatal errors and Parse Errors
You can't do this really. Especially for parse errors. Parse errors occur at a very low level, before your PHP code has actually been interpreted. There's also little reason I could see for needing this.
Are you able to elaborate on why you need this?
Are you able to elaborate on why you need this?
Re: Handle PHP Fatal errors and Parse Errors
There are some 'hacks' to get what you want, read the comments on the custom error_handler - http://www.php.net/manual/en/function.s ... .php#68470.
-
balaji4php
- Forum Newbie
- Posts: 2
- Joined: Sun Dec 07, 2008 2:22 am
Re: Handle PHP Fatal errors and Parse Errors
I need to handle all type of errors. If its a parse or fatal error, I need to handle those errors and display a customized message to the users. I appreciate your help.
Chris Corbyn wrote:You can't do this really. Especially for parse errors. Parse errors occur at a very low level, before your PHP code has actually been interpreted. There's also little reason I could see for needing this.
Are you able to elaborate on why you need this?
Re: Handle PHP Fatal errors and Parse Errors
Well, you could, but on the other level of the stack (meaning not in php). You may handle those errors on webserver level (by using ErrorDocument in apache config, or by parsing output for some specific strings).Chris Corbyn wrote:You can't do this really.