Exercise: Using the 500 HTTP Status Code
1. Open business\error_handler.php, and modify the Handler() method as shown in the following
code snippet:
/* Warnings don't abort execution if IS_WARNING_FATAL is false
E_NOTICE and E_USER_NOTICE errors don't abort execution */
if (($errNo == E_WARNING && IS_WARNING_FATAL == false) ||
($errNo == E_NOTICE || $errNo == E_USER_NOTICE))
// If the error is nonfatal ...
{
// Show message only if DEBUGGING is true
if (DEBUGGING == true)
echo '
';
}
else
// If error is fatal ...
{
// Show error message
CHAPTER 7 ?– SEARCH ENGINE OPTIMIZATION 213
if (DEBUGGING == true)
echo '
';
else
{
// Clean output buffer
ob_clean();
// Load the 500 page
include '500.php';
// Clear the output buffer and stop execution
flush();
ob_flush();
ob_end_clean();
exit();
}
// Stop processing the request
exit();
}
}
2. In the root folder of your application, create a file named 500.php, and type the following code:
// Set the 500 status code
header('HTTP/1.0 500 Internal Server Error');
require_once 'include/config.php';
require_once PRESENTATION_DIR . 'link.php';
?>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.
Pages:
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324