Larry i got the same error at this file.
Fatal error: Cannot redeclare my_error_handler() (previously declared in C:\wamp\www\php-advance-programmig\ch02\config.inc.php:54) in C:\wamp\www\php-advance-programmig\ch02\config.inc.php on line 80
And the 2nd error
Notice: Undefined variable: p in C:\wamp\www\php-advance-programmig\ch02\config.inc.php on line 40
<?php
//Errors are emailed here
$contact_email = 'example@example.com';
//Determine if you are working on a local server
//Or a real server
$host = substr($_SERVER['HTTP_HOST'], 0, 5);
if(in_array($host, array('local', '127.0', '192.1')))
{
$local = TRUE;
}
else
{
$local = FALSE;
}
if($local)
{
//Always debug when running locally
$debug = TRUE;
//Define de constants
//BASE_URI is the absolute file system path to where the site's root folder is on server
define('BASE_URI', 'C:/wamp/www/php-advance-programmig/ch02/');
//The host name and directory
define('BASE_URL', 'http://localhost/php-advance-programmig/ch02/');
//The absolute path to the file that contains the database connectivity information
define('DB', 'C:/wamp/www/php-advance-programmig/ch02/');
}
else
{
define('BASE_URI', 'path/to/live/html/folder/');
define('BASE_URL', 'http://example.com/');
define('DB', 'path/to/live/mysql.inc.php');
}
//The $debug variable si used to set error management
//To debug a specific page, add this to the index.php page
if($p == 'thismodule') $debug = TRUE;
require 'config.inc.php';
//To debug entire site, do
$debug = TRUE;
//Before this next conditional
//Assume debugging is off
if(!isset($debug)) {
$debug = FALSE;
}
//Create the error handler
function my_error_handler($e_number, $e_message, $e_file, $e_line, $e_vars)
{
global $debug, $contact_email;
//Build the error message
$message = "An error occurred in script '$e_file' on line $e_line: $e_message";
//Append $e_vars to the $message
$message .= print_r($e_vars,1);
if($debug)
{
//Show error
echo '<div class="error">' . $message . '</div>';
debug_print_backtrace();
}
else
{
//Log the error
error_log($message, 1, $contact_email); //Send the email
//Only print an error message if the error isn't a notice or strict
if(($e_number != E_NOTICE) && ($e_number < 2048))
{
echo '<div class="error"> A system error occured. We apologize for tthe inconvenience.</div>';
}
}
}//End of my_error_handler() definition
//Use the error handler
set_error_handler('my_error_handler');