Prev | Current Page 116 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


"\nLOCATION: $errFile, line " .
"$errLine, at " . date('F j, Y, g:i a') .
"\nShowing backtrace:\n$backtrace\n\n";
Depending on the configuration options from the config.php file, you decide whether to display, log, and/or
e-mail the error. Here we use PHP??™s error_log() function, which knows how to e-mail or write the error??™s
details to a log file:
// Email the error details, in case SEND_ERROR_MAIL is true
if (SEND_ERROR_MAIL == true)
error_log($error_message, 1, ADMIN_ERROR_MAIL, "From: " .
SENDMAIL_FROM . "\r\nTo: " . ADMIN_ERROR_MAIL);
// Log the error, in case LOG_ERRORS is true
if (LOG_ERRORS == true)
error_log($error_message, 3, LOG_ERRORS_FILE);
?– Note If you want to be able to send an error mail to a localhost mail account (your_name@localhost),
then you should have a Simple Mail Transfer Protocol (SMTP) server started on your machine. On a Red Hat
(or Fedora) Linux distribution, you can start an SMTP server with the following command:
service sendmail start
Also, on Windows systems, you should check in IIS (Internet Information Services) Manager for Default SMTP
Virtual Server and make sure it??™s started.
CHAPTER 3 ?–  STARTING THE TSHIRTSHOP PROJECT 57
While you are developing the site, the DEBUGGING constant should be set to true, but after launching the site in
the wild, you should make it false, causing a user-friendly error message to be displayed instead of the debugging
information in case of serious errors and no message to be shown at all in case of nonfatal errors.


Pages:
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128