Guide to PHP and MySQL (Buffalo State College Version)
Chapter 12: Error Handling
PHP provides a number of functions that allow you to handle errors gracefully. You can even write your own custom error handling function or log errors to a file.
PHP Error Handling
The error_reporting() function provides a way for you to set the error reporting level. Use the phpinfo() function to find out the error reporting level for your server. See the Predefined Error Constants for an explanation. For example, to set the reporting level to all errors and warnings:
PHP Error Logging
The ini_set() function provides a way for you log your errors to a file.
Using try / catch to Handle Exceptions
The try / catch statements provide a way for you to handle any errors gracefully.