All those darn PHP errors

sugarcrmdevelopers —  September 6, 2012 — 7 Comments

I’ve seen a lot of forums posts lately around AJAX errors coming from PHP errors being thrown, which throw off the parsing of JSON responses coming back from the server. While it’s good to know when these errors are being thrown, at the same time there’s not much value in it breaking the execution of the application in the cases that the error may be of type E_NOTICE or E_STRICT.

Generally speaking, it’s best practice in production to not log errors to the screen. You can control this by adding this directive to the php.ini file…

display_errors = stderr

Now the big question is where do these errors all go to? PHP gives a few options here with the error_log directive, where you state the file you want the errors written to…

log_errors = On
error_log = /path/to/log/file

But the more preferred method is to have the errors written to the system error log, which on Windows is the event log and Unix systems syslog(3).

log_errors = On
error_log = syslog

Doing this enables you to still track errors while not disturbing your users.

7 responses to All those darn PHP errors


    Nice post on exception handling in PHP. May i know the extension of the error log file u mentioned above in PHP.


    It’s worth noting that this can all be done easily on a windows/IIS machine using the FOSS “PHP Manager for IIS” –


    how can we go about doing this with an On Demand installation?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s