【问题标题】:Kohana 3.2 does not load the config filesKohana 3.2 不加载配置文件
【发布时间】:2011-10-02 18:07:29
【问题描述】:

我正在使用 Kohana 3.2 开发一个 Web 应用程序,并加载了以下模块:

  • 用户管理员
  • 授权
  • 数据库
  • orm
  • 分页
  • oauth
  • kohana 电子邮件

在我的开发机器(Mac OS X Lion 和 Apache)上一切正常。

在我的运行 ubuntu 10.04 和 nginx 1.1.0 的 Web 服务器上,配置文件未加载。

这在我尝试登录时生效。 Kohana 给我以下错误:

A valid hash key must be set in your auth config.

如果我看一下 Kohana::$config,它是空的。这让我得出结论,我的配置没有加载。

有没有人知道什么会导致这种行为。

我的目录是这样的

application/
├── bootstrap.php
├── cache
├── classes
│   ├── controller
│   │   ├── …
│   └── model
├── config
│   ├── auth.php
│   ├── database.php
│   └── pagination.php
├── i18n
│   └── …
├── logs
│   └── …
├── messages
└── views
    └── template
        └── default.php

编辑:因为我想错误一定是在我的服务器环境中,这是我的 nginx 配置。

服务器{ 听 80;

    root /srv/www/;
    index index.php;

    location / {
            try_files $uri /index.php?$query_string;
    }

    location /index.php {
            fastcgi_param KOHANA_ENV development;
            fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root/index.php;
            include /etc/nginx/fastcgi_params;
    }

}

【问题讨论】:

    标签: nginx kohana config kohana-3


    【解决方案1】:

    语法在 3.2 中略有改变

    Kohana::$config 将保持为空,直到您实际将配置文件加载到其中,其中:

    Kohana::$config->load('auth')
    

    migration from 3.1.x section 的用户指南中已解决此问题。

    【讨论】:

    • 死不会成功。 $config 变量保持为空。我想这个错误需要在我的服务器环境中搜索,因为应用程序在我的开发机器上运行时正在运行。
    • 嗯……奇怪。检查您的配置文件夹是否具有写入权限。在这种情况下它并不重要,但它必须是可写的
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多