Skip to content

Instantly share code, notes, and snippets.

@alexdmejias
Created April 16, 2013 13:57
Show Gist options
  • Save alexdmejias/5396091 to your computer and use it in GitHub Desktop.
Save alexdmejias/5396091 to your computer and use it in GitHub Desktop.
use the same wp-config.php across multiple dev setups
<?php
$domain = $_SERVER[HTTP_HOST];
if ($domain === '') : // If is live enviroment
define('DB_NAME', 'our_live_db');
define('DB_USER', 'our_live_user');
define('DB_PASSWORD', 'our_live_password');
define('DB_HOST', 'localhost');
elseif () : // If is staging enviroment
define('DB_NAME', 'our_staging_db');
define('DB_USER', 'our_staging_user');
define('DB_PASSWORD', 'our_staging_password');
define('DB_HOST', 'localhost');
else () : // If none, fallback to these
define('DB_NAME', 'fallback_db');
define('DB_USER', 'fallback_user'); // Usually 'root'
define('DB_PASSWORD', 'fallback_password'); // Usually 'root' too
define('DB_HOST', 'localhost');
endif;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment