500服务器错误-无限循环


500 Server Error - Infinite Loop

症状

我正在尝试设置2个虚拟路径,每个路径对应于我的php应用程序。一个使用Kohana,另一个使用Zend。两个主页都运行良好。然而,当我深入浏览Kohana应用程序时,我会得到一个500内部服务器错误。

由于我只安装了Zend骨架应用程序,所以我只有一个默认主页。正因为如此,在添加新页面后,我可能会发现我的Zend应用程序也存在这个问题。然而,我不希望出现这种情况,因为我没有像使用Kohana应用程序那样在主页上遇到任何丢失的CSS(更多关于这种症状的信息,请参阅Kohana引导部分)

apache错误日志

以下是日志文件显示的内容,从下到上阅读它以查看模式。

redirected from r->uri = /user/login, referer: http://app1:8080/
redirected from r->uri = /app1/index.php/user/login, referer: http://app1:8080/
redirected from r->uri = /app1/index.php/app1/index.php/user/login, referer: http://app1:8080/
redirected from r->uri = /app1/index.php/app1/index.php/app1/index.php/user/login, referer: http://app1:8080/
...continues for 7 more loops, the redirect uri growing in the same pattern each time
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://app1:8080/

因此,从日志中可以明显看出,有一个循环是由我在代码中搞砸的东西引起的。我只是不知道是哪一个。

httpd.conf

这是我添加到httpd.conf以设置新的虚拟主机的内容

<VirtualHost app1:8080>
    ServerName app1
    DocumentRoot /Applications/MAMP/htdocs/app1/
    SetEnv APPLICATION_ENV "development"
</VirtualHost>
# this is for the zend app that seems to be working fine
<VirtualHost app2:8888>
    ServerName app2
    DocumentRoot /Applications/MAMP/htdocs/app2/public
    SetEnv APPLICATION_ENV "development"
</VirtualHost>

etc/主机

我不认为这是问题所在,但为了彻底起见,我在hosts文件中添加了以下内容:

127.0.0.1       app1
127.0.0.1       app2

.htaccess

我也不认为问题出在我的.htaccess中,因为我可以评论整个事情,但仍然会得到这个错误,但无论如何,它就在这里,这样你就可以看到我已经添加了什么来尝试修复它:

# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)/ - [F,L]
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php [PT]
RewriteLogLevel 3
LogLevel debug

Kohana引导程序

最后但同样重要的是,我对Kohana bootstrap.php文件所做的更改为我提供了一个工作主页。在此更改之前,我收到了一个无CSSless的html页面:

Kohana::init(array(
    //'base_url'   => '/app1/',
    'base_url'     => '/',
    'index_file'   => false
));

不幸的是,我不知道发生这种情况的确切原因。我将httpd.conf、.htaccess和etc/hosts恢复为默认值。问题已经解决,但我不得不使用localhost。改天我会再次尝试制作漂亮的开发URL。