Cakephp shell: HelloShell shell class not found

I am new to cakephp. I am setting up the cakephp shell as cakephp says in the manual when I start HelloShell using the cake command Hello, I got the error information as follows:

Error: Shell class HelloShell could not be found. 1#G:\htdocs\cakedemo\lib\Cake\Console\ShellDispatcher.php(191):ShellDispatcher>_getShell('hello') 2#G:\htdocs\cakedemo\lib\Cake\Console\ShellDispatcher.php(69):ShellDispatcher->dispatch() 3#G:\htdocs\cakedemo\app\Console\cake.php(33):ShellDispatcher::run(Array) {main} 

my cakephp version:

Welcome to CakePHP v2.2.0-beta Console

Application: Console

Path: G: \ htdocs \ cakedemo \ app \ Console \

anyone who can help can give me advice, please.

+7
source share
3 answers

there is your mistake. You must always be in your APP path to start the cake console.

 ...app/>../lib/Cake/Console/cake MyShell 

or (using the APP console folder):

 ...app/>Console/cake MyShell 

and MyShell should be in ...app/Console/Command/ . That is all that is needed.

+14
source

Error: Shell class HelloShell could not be found appears because: typo error or start command in the wrong directory.

Decision:

1. Installation path for php.exe, cake.exe

2. For example, my root Cake site:

 C:\tools\xampp1.8.3\htdocs\cakephp-2.5.5 

Create a new file in the folder C:\tools\xampp1.8.3\htdocs\cakephp-2.5.5\app\Console\Command\HelloShell.php with the content:

 class HelloShell extends AppShell { public function main() { $this->out('Hello world.'); } } 

3. Open cmd , enter:

 cd /d C:\tools\xampp1.8.3\htdocs\cakephp-2.5.5\app cake hello 

We use hello on the command line to call the HelloShell class, because it’s a "convention on configuration."

enter image description here

Link: http://book.cakephp.org/2.0/en/console-and-shells.html#creating-a-shell

+2
source

Make sure you specify the path to the cake folder in /var/www/html/Console/cake.php ini_set ('include_path', $ root. PATH_SEPARATOR. 'Cake'. $ Ds. 'Lib'.PATH_SEPARATOR. Ini_get (' include_path '));

Then go to the root folder. In my case, the location would be / Var / WWW / HTML / then specify the shell file name; Hi my shell name, that would be / var / www / html / Console / Cake Greetings combining / var / www / html $ / var / www / html / Console / Cake Greetings

Your shell will be executed.

0
source

All Articles