mottwsc Posted October 9, 2009 Share Posted October 9, 2009 I'm using php5 on linux and do not want to send any error messages to the user but instead to a log file. Which is better in general for this purpose: trigger_error or error_log? In certain cases, I'll also send an email notification on error. For this, I'll use error_log. Is this the best way to do this? Thanks! Quote Link to comment Share on other sites More sharing options...
trq Posted October 9, 2009 Share Posted October 9, 2009 Which is better in general for this purpose: trigger_error or error_log? Doesn't really make sense. They both serve a completely different purpose. Quote Link to comment Share on other sites More sharing options...
mottwsc Posted October 9, 2009 Author Share Posted October 9, 2009 It appears that they are/can be used to re-direct errors when you do not want them sent to the user. I'm trying to determine the pros and cons of one vs. the other. Could anyone be more helpful / specific on this? Quote Link to comment Share on other sites More sharing options...
mottwsc Posted October 9, 2009 Author Share Posted October 9, 2009 I've figured this out - thanks anyway. Quote Link to comment Share on other sites More sharing options...
Dominic_108 Posted February 18, 2017 Share Posted February 18, 2017 I know it's old, but I could not myself from making a comment. To say that error_log and trigger_error have completely different purposes and that the question made no sense is what made no sense. The question made perfect sense. Both uses the php ini directive error_log that sets a log file location, defaulting to the web server log if no value is set in error_log. So, they certainly have a related purpose. One difference is that the error_log function will perform its duties regardless of the value set in the log_errors ini setting. It does not raise a PHP error, so it does not have a severity level. So, you have more control with trigger_error, but one might want to bypass this control and directly send to the log_error destination without raising a PHP error or warning, etc. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.