Skip to content

Instantly share code, notes, and snippets.

@hengkiardo
Created November 26, 2012 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hengkiardo/4147311 to your computer and use it in GitHub Desktop.
Save hengkiardo/4147311 to your computer and use it in GitHub Desktop.
Database configuration file for MySQL service at AppFog Cloud
<?php
$services_json = json_decode(getenv("VCAP_SERVICES"),true);
$mysql_config = $services_json["mysql-5.1"][0]["credentials"];
$username = $mysql_config["username"];
$password = $mysql_config["password"];
$hostname = $mysql_config["hostname"];
$port = $mysql_config["port"];
$db = $mysql_config["name"];
mysql_connect($hostname,$username,$password);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment