Skip to content

Instantly share code, notes, and snippets.

@bkozora
Created April 13, 2016 12:31
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 bkozora/f70cfe4b91d9ce909c6952ddf4bee7d7 to your computer and use it in GitHub Desktop.
Save bkozora/f70cfe4b91d9ce909c6952ddf4bee7d7 to your computer and use it in GitHub Desktop.
Magento - Retrieve DB Info from local.xml
<?php
// Bootstrap Magento
require_once("../www/app/Mage.php");
$app = Mage::app('default');
// Grab our database config info
$config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
// Connect to our RDS MySQL instance
$mysqli = new mysqli($config->host, $config->username, $config->password, $config->dbname);
// check RDS MySQL connection
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment