MySQL / CodeIgniter configuration on OpenShift

2019-08-13 02:33发布

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?

1条回答
三岁会撩人
2楼-- · 2019-08-13 03:00

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

rhc app restart

查看更多
登录 后发表回答