0

我正在尝试以我喜欢的方式设置我的 CakePHP 开发环境,但我遇到了问题。

这是我的目录结构的样子

/dev/
    - vhosts/
        - app1/
        - app2/
        - app3/
    - lib/
        - cakephp/
        - otherlibs/

你明白了,我希望能够轻松地设置多个 CakePHP 应用程序,运行位于外部目录中的一个核心。

我在 webroot/index.php 中设置了以下值

if (!defined('ROOT')) {
    define('ROOT', '/dev');
}

if (!defined('APP_DIR')) {
    define('APP_DIR', '/dev/vhosts/myapp');
}

define('CAKE_CORE_INCLUDE_PATH', '/dev/lib/cakephp/lib');

但是,当尝试访问我的应用程序时出现 500 错误:

[Tue Sep 10 10:22:46 2013] [error] [client 127.0.0.1] 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.

我有两个问题:

  1. 谁能引导我朝着正确的方向调试这个问题?
  2. 我可以期待(可能需要做一些工作)一个设置,我可以轻松自动地在我的虚拟主机目录中烘焙应用程序,并预先设置所有这些变量(甚至可能在我的开发服务器上创建数据库^^)?

编辑: 经过一番修改后,我将错误范围缩小到我的 htaccess 配置。事实上,它似乎CAKE_CORE_INCLUDE_PATH确实需要指向lib/CakePHP 安装中的目录(根据第 38 行webroot/index.php)。

我可以进入 Cake 欢迎页面,但没有 CSS,因为所有资产都在 webroot 中。因此,我按照 Cake Docs 的建议将以下内容添加到 htaccess 中:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

此时得到错误 500,它在 apache_error.log 中返回这个

[error] 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.
[debug] r->uri = /Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/index.php
[debug] redirected from r->uri = /Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/index.php
[debug] redirected from r->uri = /Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/index.php
[debug] redirected from r->uri = /Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/index.php
[debug] redirected from r->uri = /Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/index.php
[debug] redirected from r->uri = /Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/index.php
[debug] redirected from r->uri = /Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/index.php
[debug] redirected from r->uri = /Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/index.php
[debug] redirected from r->uri = /Volumes/Home/dev/vhosts/myapp/webroot/Volumes/Home/dev/vhosts/myapp/webroot/index.php
[debug] redirected from r->uri = /Volumes/Home/dev/vhosts/myapp/webroot/index.php
[debug] redirected from r->uri = /index.php
4

1 回答 1

1

你的路径应该是:

define('ROOT',  DS.'dev'.DS.'vhosts');
define('APP_DIR',   'app1');
define('CAKE_CORE_INCLUDE_PATH', DS.'dev'.DS.'lib'.DS.'cakephp');
于 2013-09-10T09:23:50.177 回答