Skip to content

Instantly share code, notes, and snippets.

@cam-gists
Created September 11, 2012 05:43
Show Gist options
  • Save cam-gists/3696233 to your computer and use it in GitHub Desktop.
Save cam-gists/3696233 to your computer and use it in GitHub Desktop.
PHP : config file
<?php
/**
* @author <Chris Moore>
* Config file sets all global options
* And Loads all Dependencies
* */
/**
* @param environment = prod, dev , etc. ..
* */
$global_config['version'] = 3.1;
/**
* @param environment = prod, dev , etc. ..
* */
$global_config['environment'] = 'osx';
/**
* @param include_path relative to root
* */
$global_config['include_path'] = 'inc/';
/**
* @param include_path relative to root`
* */
$global_config['base_url'] = 'cam.adserve.local';
/**
* Setup Constants
* */
/**
* DEBUG logs errors throughout the system if set to true
* */
if($global_config['environment'] === 'osx'){
define('DEBUG','VERBOSE'); // ERRORS
define('USERNAME','root');
define('PASSWORD','root');
define('USERNAME2','root');
define('PASSWORD2','root');
//*----------------------------------DEBUG ----------------------------------------*/
error_reporting(E_ALL);
ini_set("display_errors", 1);
//*----------------------------------DEBUG ----------------------------------------*/
}else{
//*----------------------------------DEBUG ----------------------------------------*/
error_reporting(0);
ini_set("display_errors", 0);
//*----------------------------------DEBUG ----------------------------------------*/
define('DEBUG',FALSE);
define('USERNAME','root');
define('PASSWORD','root');
define('USERNAME2','root');
define('PASSWORD2','root');
}
define('HOST', 'localhost');
// Set Memcache Expiration
define('MEMCACHE_EXPIRE', 30); // units are seconds. '0' means never expires.
define('APP_PATH', $_SERVER['DOCUMENT_ROOT']);
define('INC_PATH', APP_PATH . '/' . $global_config['include_path'] );
if(DEBUG === 'VERBOSE'){
//*----------------------------------DEBUG ----------------------------------------*/
error_reporting(E_ALL);
ini_set("display_errors", 1);
//*----------------------------------DEBUG ----------------------------------------*/
}
$config['version'] = $global_config['version'];
$config['environment'] = $global_config['environment'];
$config['base_url'] = $global_config['base_url'];
$config['debug'] = DEBUG;
$config['usersname'] = USERNAME;
$config['password'] = PASSWORD;
$config['usersname2'] = USERNAME2;
$config['password2'] = PASSWORD2;
$config['host'] = HOST;
$config['app_path'] = APP_PATH;
$config['inc_path'] = INC_PATH;
$config['memcache_expire'] = MEMCACHE_EXPIRE;
require_once('class_db.
require_once('ChromePhp.php');
require_once('base.class.php');
require_once('class_serve.php');
require_once('class_module.php');
// require_once('class_memcache.php');
require_once('wrapper.class.php');
Base::log('Config Loaded Successfully: ' . __FILE__ . ' - Line: '. __LINE__, 'log' );
Base::log($config, 'log' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment