Kohana 3.2 不加载配置文件
我正在使用 Kohana 3.2 开发一个 Web 应用程序,并加载了以下模块:
- useradmin
- auth
- 数据库
- orm
- 分页
- oauth
- kohana-email
在我的开发机器(带有 Apache 的 Mac OS X Lion)上,一切都很好。
在我的运行 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;
}
}
I am developing a web app using Kohana 3.2 with the following modules loaded:
- useradmin
- auth
- database
- orm
- pagination
- oauth
- kohana-email
On my development machine (Mac OS X Lion with Apache) everything its fine.
On my web server running ubuntu 10.04 with nginx 1.1.0 the config files are not loaded.
This comes to effect when i try to login. Kohana gives me the following error:
A valid hash key must be set in your auth config.
If I have a look at Kohana::$config, it is empty. Which gives me the conclusion that the my configurations are not loaded.
Does anyone have an idea what can cause such a behavior.
My directory looks like this
application/
├── bootstrap.php
├── cache
├── classes
│ ├── controller
│ │ ├── …
│ └── model
├── config
│ ├── auth.php
│ ├── database.php
│ └── pagination.php
├── i18n
│ └── …
├── logs
│ └── …
├── messages
└── views
└── template
└── default.php
EDIT: For I suppose the error must be in my server environment, here is my nginx configuration.
server {
listen 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;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
语法在 3.2 中进行了一些更改
Kohana::$config
将保持为空,直到您实际将配置文件加载到其中:这已在用户指南中的 从 3.1.x 部分迁移。
The syntax has been changed a little in 3.2
Kohana::$config
will stay empty until you actually load the config file into it, with:This has been addressed in the user guide in the migration from 3.1.x section.