CakePhp 2.4“错误:找不到Shell类HelloShell。”道路一团糟?

时间:2014-01-17 10:29:12

标签: shell cakephp console cakephp-2.4

我在这个主题上找到了几个答案,但没有一个能帮助我。

情况就是这样。我在ubuntu系统上工作,我的默认cakephp 2.4.4安装在:

/var/www/myproject/
  /gkm-be (this is my app)
  /lib/Cake

因此这里的所有路径都是默认路径,gkm_be应用程序通常运行顺畅。

在我的.bashrc中,我有以下设置:

PATH=$PATH:$HOME/bin
export PATH="$PATH:/var/www/myproject/lib/Cake/Console/"

当我打开一个新shell并转到目录/ var / www / myproject / gkm-be并输入时     控制台/蛋糕 我收到了错误     bash:console / cake:找不到文件或目录 后     cd / var / www / myproject / gkm-be / Console / 如果我输入蛋糕然后我得到核心蛋糕与以下输出

Welcome to CakePHP v2.4.4 Console
---------------------------------------------------------------
App : Console
Path: /var/www/myproject/gkm-be/Console/
---------------------------------------------------------------
Current Paths:

-app: Console
-working: /var/www/myproject/gkm-be/Console
-root: /var/www/myproject/gkm-be
-core: /var/www/myproject/lib

Changing Paths:

Your working path should be the same as your application path. To change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp

Available Shells:

[CORE] acl, api, bake, command_list, console, i18n, schema, server, test, testsuite, upgrade

请注意-app和-working

的路径

当然,我的HelloShell位于

之下
/var/www/myproject/gkm-be/Console/Command/HelloShell.php

既未列出也未被调用。

我设置了错误的路径吗?任何人都可以发现错误吗?

Calamity Jane

PS:来自shell的代码:

class HelloShell extends AppShell
{

    public function main()
    {
        date_default_timezone_set('Europe/Berlin');
        $this->out('Hello world.');
    }

}

1 个答案:

答案 0 :(得分:2)

转到/var/www/myproject/gkm-be并运行命令

../lib/Cake/Console/cake Hello