2

我在 Codeigniter 框架中运行一个网站。我正在使用postgresql。我浏览了 APPFOG 文档。但我不清楚我如何配置 postgres 数据库。我在哪里托管数据库?如何进行数据库更新?

4

1 回答 1

3

在 application/config 中的 Database.php,替换行,

<pre>
$db['default']['hostname'] = '<ur hostname>';
$db['default']['username'] = '<ur db username>';
$db['default']['password'] = '<ur db password>';
$db['default']['database'] = '<ur db name>';
</pre>

<pre>
$VCAP_SERVICES = getenv("VCAP_SERVICES");
$VCAP_SERVICES_json = json_decode($VCAP_SERVICES, true);
$VCAP_SERVICES_postgresql_config = $VCAP_SERVICES_json["postgresql-9.1"][0]["credentials"];
$db['default']['hostname'] = $VCAP_SERVICES_postgresql_config['hostname'];
$db['default']['username'] = $VCAP_SERVICES_postgresql_config['user'];
$db['default']['password'] = $VCAP_SERVICES_postgresql_config['password'];
$db['default']['database'] = $VCAP_SERVICES_postgresql_config['name'];
</pre>

这将负责数据库连接。使用 af tunnel 进行更新。

于 2012-10-09T18:34:21.233 回答