0

症状

我正在尝试设置 2 个虚拟路径,一个用于我的每个 php 应用程序。一个使用 Kohana,另一个使用 Zend。两个主页都可以正常工作。然而,当我深入浏览 Kohana 应用程序时,我收到 500 Internal Server 错误。

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

阿帕奇错误日志

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

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>

等/主机

我不认为这是问题所在,但为了彻底,这里是我添加到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 引导程序

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

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

1 回答 1

0

不幸的是,我无法弄清楚为什么会发生这种情况。我将 httpd.conf、.htaccess 和 etc/hosts 恢复为默认值。问题已解决,但我不得不使用 localhost。改天再尝试制作漂亮的开发网址。

于 2013-03-04T04:31:38.047 回答