Skip to content

Instantly share code, notes, and snippets.

@luckyshot
Created October 3, 2013 00:11
Show Gist options
  • Save luckyshot/6802531 to your computer and use it in GitHub Desktop.
Save luckyshot/6802531 to your computer and use it in GitHub Desktop.
Smart config.php Development / Production server
<?php
define('DEBUG', in_array($_SERVER['HTTP_HOST'], array('127.0.0.1', 'localhost')) );
if (DEBUG==false) {
// PRODUCTION SEVER
error_reporting(0);
define('APP_URL', 'http://www.example.com/');
define('MYSQL_SERVER', 'localhost'); //
define('MYSQL_DATABASE', 'database'); //
define('MYSQL_USER', 'user'); //
define('MYSQL_PASS', 'pass'); //
}else{
// DEVELOPMENT SERVER
error_reporting(E_ALL);
define('APP_URL', 'http://127.0.0.1/example/');
define('MYSQL_SERVER', 'localhost'); //
define('MYSQL_DATABASE', 'database'); //
define('MYSQL_USER', 'user'); //
define('MYSQL_PASS', 'pass'); //
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment