开发者

Kohana config database - enabling

I can't make to Config_Database work.

I'm enabling new Config Source that way:

Kohana::$config->attach(new Config_Database, FALSE);

I'm loading that source after loading modules - in the bottom of bootstrap.php file.

I get this error when I'm trying to enable this Config Source

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to all开发者_开发知识库ocate 261900 bytes) in /var/www/moje/modules/database/classes/kohana/config/database/writer.php on line 124 

Line 124 in file (.../)database/writer.php doesnt exists - it has only 111 lines.

What's going wrong?

edit: Kohana 3.2


This sounds like a bug in 3.2 I have got it to work with 3.0 (haven't tried 3.1). Here's the thread in Kohana Forums:

http://forum.kohanaframework.org/discussion/9637/config_database-and-the-out-of-memory-error/p1


It's going because Kohana trying to load database settings from database (and it's going to recursion)

You should initialize your database instance before attaching Config_Database reader

Try this (in bootstrap.php, after Kohana::modules()):

Database::instance();

Kohana::$config->attach(new Config_Database, FALSE);


Or you can simply load database config right before adding the Config_Database

Kohana::$config->load('database');
Kohana::$config->attach(new Config_Database, FALSE);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜