1

I've deployed a PHP/CodeIgniter app to my OpenShift gear, but I'm getting an error

Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346

After reading around, I'm guessing this is a problem of setting up my database configuration in CodeIgniters config/database.php

I've picked up that Openshift advises using environment variables rather than ip addresses, I've retrieved my details through SSH > grep|env and I've tried various ways of putting them in, without success.

$db['default']['hostname'] = $_ENV['OPENSHIFT_MYSQL_DB_HOST'];
$db['default']['username'] = '...'; //proper username
$db['default']['password'] = '...'; // proper password
$db['default']['database'] = 'products';
$db['default']['dbdriver'] = 'mysql';

etc...

So my question is this: Where can I find a sample of an OpenShift config/database.php file as used in a PHP/CodeIgniter app?

Maxcot
  • 1,513
  • 3
  • 23
  • 51
  • http://stackoverflow.com/questions/15921169/how-to-connect-to-the-database-in-openshift-application – J. Bruni Jun 10 '13 at 03:51

1 Answers1

2

Try restarting your application to see if just isn't picking up the environment variables.

rhc app restart

gshipley
  • 419
  • 2
  • 2