Skip to content

Instantly share code, notes, and snippets.

@eddturtle
Created April 25, 2014 14:08
Show Gist options
  • Save eddturtle/11290848 to your computer and use it in GitHub Desktop.
Save eddturtle/11290848 to your computer and use it in GitHub Desktop.
PHP Split ClearDB Heroku ENV
<?php
// https://devcenter.heroku.com/articles/cleardb#using-cleardb-with-python-django
$url=parse_url(getenv("CLEARDB_DATABASE_URL"));
$server = $url["host"];
$username = $url["user"];
$password = $url["pass"];
$db = substr($url["path"],1);
mysql_connect($server, $username, $password);
mysql_select_db($db);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment