Php 部署Kohana 3.3时出现错误500
我一直在谷歌上搜索一个解决方案,或者一些可以引导我找到部署我的Kohana 3.3站点的解决方案的东西,但是没有用 我对如何使路由在Kohana中工作感到困惑,我在bootstrap.php文件中保留了默认路由。在这里:Php 部署Kohana 3.3时出现错误500,php,routes,kohana-3,Php,Routes,Kohana 3,我一直在谷歌上搜索一个解决方案,或者一些可以引导我找到部署我的Kohana 3.3站点的解决方案的东西,但是没有用 我对如何使路由在Kohana中工作感到困惑,我在bootstrap.php文件中保留了默认路由。在这里: Route::set('default', '(<controller>(/<action>(/<id>)))') ->defaults(array( 'controller' => 'welcome', 'act
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'welcome',
'action' => 'index',
));
Controller/admin.php
.htaccess
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /atosoft.neq3.com/
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Protect application and system files from being viewed
# RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
RewriteRule ^(application|modules|system)/ - [F,L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
# RewriteRule .* index.php/$0 [PT]
RewriteRule .* index.php [PT]
#启用URL重写
重新启动发动机
#安装目录
RewriteBase/atosoft.neq3.com/
#保护隐藏文件不被查看
命令拒绝,允许
全盘否定
#保护应用程序和系统文件不被查看
#重写规则^(?:应用程序|模块|系统)\b.*index.php/$0[L]
重写规则^(应用程序|模块|系统)/-[F,L]
#允许直接显示现有的任何文件或目录
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#将所有其他URL重写为index.php/URL
#重写规则。*index.php/$0[PT]
重写规则。*index.php[PT]
您的重写库错误。这来自知识库:
你支持搜索引擎友好的URL吗
是的,支持搜索引擎友好的URL,但是有一个
您必须知道的重要一点是:我们使用虚拟用户目录路径,所以
尝试设置搜索引擎友好的URL或URL时可能会出错
正在尝试将虚拟目录名传递给PHP脚本。如果可以的话
很简单。编辑.htaccess文件,并将此行添加到
第一个重写规则之前的文件:
重写基/
注意:如果脚本安装在某个目录上,例如
/论坛,您必须将RewriteBase/forum/line放置到.htaccess
文件(.htaccess文件也必须位于/forum目录中)
除此之外,请检查APPPATH/classes/中的所有文件,并在必要时重命名它们。例如:APPATH/classes/Controller/admin.php
应该是APPPATH/classes/Controller/admin.php
应该是这样。如果您的kohana文件夹当前位于
/public\u html
文件夹中,您可能需要对此采取一些措施。在可能的情况下,最好将尽可能多的文件放在web根目录之外。您需要了解一般“500”错误的实际含义-它将出现在您的日志文件中。我查看了Kohana的日志文件夹,但其中没有说明问题,当前日期没有记录任何内容。请尝试您的Apache/PHP日志:)
日志是否可能存储在服务器的其他位置?好的,我刚刚尝试过,免费服务不允许我访问日志,我已仔细遵循PSR-0支持,我用example.htaccess中的文件替换了根目录中的.htaccess文件,现在我得到了一个Kohana_HTTP_异常[404]:在此服务器上找不到请求的URL管理员。我是否还需要将引导中的基本url从我的域更改为/?好,我就快到了@Darsstar!!现在,它无法识别它说的是ErrorException[致命错误]:找不到类“url”
class Controller_Admin extends Controller_Template {
public $template = 'admin_template';
public function action_index() {
// User authentication
$user = Auth::instance()->get_user();
if(Auth::instance()->logged_in()) {
// Display Dashboard here
$dashboard = View::factory('admin/index');
$this->template->user = $user;
$this->template->content = $dashboard;
} else {
HTTP::redirect('user/login');
}
}
}
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /atosoft.neq3.com/
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Protect application and system files from being viewed
# RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
RewriteRule ^(application|modules|system)/ - [F,L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
# RewriteRule .* index.php/$0 [PT]
RewriteRule .* index.php [PT]