Skip to content

Instantly share code, notes, and snippets.

Created January 7, 2013 10:31
Show Gist options
  • Save anonymous/4473968 to your computer and use it in GitHub Desktop.
Save anonymous/4473968 to your computer and use it in GitHub Desktop.
Use this in wp-config to be able to run the blog both locally and deployed on AppFog.
$services = getenv("VCAP_SERVICES");
if ( $services != null){
$services_json = json_decode($services,true);
$mysql_config = $services_json["mysql-5.1"][0]["credentials"];
define('DB_NAME', $mysql_config["name"]);
define('DB_USER', $mysql_config["user"]);
define('DB_PASSWORD', $mysql_config["password"]);
define('DB_HOST', $mysql_config["hostname"]);
define('DB_PORT', $mysql_config["port"]);
}
else{
define('DB_NAME', "localdb");
define('DB_USER', "root");
define('DB_PASSWORD', "password");
define('DB_HOST', "localhost");
define('DB_PORT', 8889);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment