Logging PHP Errors
In the previous example, errors were handled by simply printing them out in detail or not. Another option is to log the errors: make a permanent note of them somehow. For this purpose, the error_log() function instructs PHP how to file an error.
error_log (message, type, destination, → extra headers);
The message value should be the text of the logged error. The type dictates how the error is logged. Table 6.2 lists the types of error logging you can use. The destination parameter can be either the name of a file (for log type 3) or an email address (for log type 1). The extra headers argument is used only when sending emails (log type 1). Both the destination and extra headers are optional.
Get PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.