Every PHP web-application needs to have a file that boot-straps the rest of the application. These files set the base environment, load necessary libraries and configurations. Many times these files have some intelligence for Test vs Live mode. Bootstrappers generally finish by dispatching the request in some application specific manner.

The boot strap sample below is a one of general usage around here. Similar code can be found in applications we write with CakePHP, Zend Framework, Radix and even non-framework based custom PHP sites.

// Base Datas
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');

// ini_set('allow_call_time_pass_reference',false); // perdir
ini_set('date.timezone','America/Los_Angeles');
ini_set('display_errors',true);
ini_set('display_startup_errors',true);
// ini_set('error_append_string',null);
ini_set('error_log',dirname(dirname(__FILE__)).'/var/log/error.log');
// ini_set('error_prepend_string',null);
 ini_set('error_reporting',E_ALL | E_STRICT);
ini_set('html_errors', php_sapi_name()=='CLI' ? false : true );
ini_set('ignore_repeated_errors',true);
ini_set('ignore_repeated_source',true);
ini_set('implicit_flush',false);
$path = array();
$path[] = dirname(__FILE__).'/lib';
$path[] = get_include_path();
ini_set('include_path',implode(PATH_SEPARATOR,$path));
// ini_set('last_modified',true);
ini_set('log_errors',true);
ini_set('magic_quotes_runtime',false);
set_time_limit(20);

// @todo check magic_quotes_gpc
if (get_magic_quotes_gpc()) {
    die('get_magic_quotes_gpc fail');
}

if ( SITE_MODE == 'live' ) {
    ini_set('display_errors',true);
    ini_set('display_startup_errors',true);
    ini_set('error_reporting', E_ERROR);
}

// Application Dispatches Here

See Also