找不到Shell类HelloShell

找不到Shell类HelloShell

本文介绍了CakePhp 2.4“错误:找不到Shell类HelloShell."路径混乱吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了关于该主题的几个答案,但没有一个对我有帮助.

I have found several answers on that topic, but none did help me.

这就是这种情况.我在ubuntu系统上工作,默认的cakephp 2.4.4安装在以下位置:

So here is the situation. I work on a ubuntu system and my default cakephp 2.4.4 installation is under:

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

因此,此处的所有路径均为默认路径,并且gkm_be应用程序总体上运行正常.

So all paths here are default and the gkm_be app in general is working smoothly.

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

In my .bashrc I have the following setting:

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

当我打开一个新的外壳并转到目录/var/www/myproject/gkm-be并键入控制台/蛋糕我得到了错误bash:控制台/蛋糕:找不到文件或目录后cd/var/www/myproject/gkm-be/Console/如果我输入蛋糕,那么我将得到以下输出的核心蛋糕

When I open a new shell and go to the directory /var/www/myproject/gkm-be and type Console/cakeI get the error bash: Console/cake: File or directory not foundafter cd /var/www/myproject/gkm-be/Console/if I enter cake then I get the core cake with following output

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的路径

Note the paths for -app and -working

当然,我的HelloShell位于

Not to mention of course that my HelloShell located under

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

既未列出,也无法调用.

is neither listed nor can be called.

我设置的路径错误吗?有人可以发现错误吗?

Were did I set a path wrong? Can anybody spot the mistake?

卡拉扬简

PS:来自外壳的代码:

PS: The code from the shell:

class HelloShell extends AppShell
{

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

}

推荐答案

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

../lib/Cake/Console/cake Hello

这篇关于CakePhp 2.4“错误:找不到Shell类HelloShell."路径混乱吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 14:42