Skip to content

Instantly share code, notes, and snippets.

@ryancragun
Created May 4, 2011 17:56
Show Gist options
  • Save ryancragun/955661 to your computer and use it in GitHub Desktop.
Save ryancragun/955661 to your computer and use it in GitHub Desktop.
set hostname db from metadata
<?php
$METADATA = file("/var/spool/ec2/meta-data-cache.sh");
foreach ($METADATA as $line) {
$data = explode ('=',$line);
switch ($data[0]) {
case "export EC2_HOSTNAME":
$hostname_DB = $data[1];
break;
}
}
//DataBase Connect Infomation
$database_DB = "phptestdb";
$username_DB = "admin";
$password_DB = "madem0";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment