Last active
December 15, 2015 13:29
-
-
Save rianrainey/5267534 to your computer and use it in GitHub Desktop.
Drupal 7 settings.php to run on Heroku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = parse_url(getenv('DATABASE_URL')); // Be sure to run [heroku config:set DATABASE_URL=mysql://db_username:db_password@amazon_rds_instance_name/db_name] | |
$databases['default']['default'] = array( | |
// MySQLi uses the mysql driver. | |
'driver' => $url['scheme'] == 'mysqli' ? 'mysql' : $url['scheme'], | |
// Remove the leading slash to get the database name. | |
'database' => substr(urldecode($url['path']), 1), | |
'username' => urldecode($url['user']), | |
'password' => isset($url['pass']) ? urldecode($url['pass']) : '', | |
'host' => urldecode($url['host']), | |
'port' => isset($url['port']) ? urldecode($url['port']) : '', | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment