Skip to content

Instantly share code, notes, and snippets.

@Gaubee
Created December 11, 2013 11:01
Show Gist options
  • Save Gaubee/7908524 to your computer and use it in GitHub Desktop.
Save Gaubee/7908524 to your computer and use it in GitHub Desktop.
<?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"];
$link = mysql_connect("$hostname:$port", $username, $password);
$db_selected = mysql_select_db($db, $link);
echo "services_json:".$services_json."<br>";
echo "username:".$username."<br>";
echo "password:".$password."<br>";
echo "hostname:".$hostname."<br>";
echo "port:".$port."<br>";
echo "db:".$db."<br>";
echo "link:".$link."<br>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment