OpenShift上的MySQL / CodeIgniter配置 [英] MySQL / CodeIgniter configuration on OpenShift
问题描述
我已经为我的OpenShift装置部署了一个PHP / CodeIgniter应用程式,但发生错误
I've deployed a PHP/CodeIgniter app to my OpenShift gear, but I'm getting an error
无法连线至您的资料库伺服器提供的设置。
文件名:core / Loader.php
行号:346
Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346
阅读后,我猜这是一个问题在CodeIgniters中设置我的数据库配置config / database.php
After reading around, I'm guessing this is a problem of setting up my database configuration in CodeIgniters config/database.php
我选择了Openshift建议使用环境变量而不是ip地址,我检索了我的详细信息通过SSH> grep | env和我尝试了各种方式把它们,没有成功。
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...
所以我的问题是:找到一个在PHP / CodeIgniter应用程序中使用的OpenShift config / database.php文件的示例?
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?
推荐答案
尝试重新启动应用程序,看看是否只是没有拾取环境变量。
Try restarting your application to see if just isn't picking up the environment variables.
rhc应用程式重新启动
rhc app restart
这篇关于OpenShift上的MySQL / CodeIgniter配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!